Loadman
Loadman

Reputation: 9107

Using Partial classes for autogen code, how to setup filenaming etc?

I have a datalayer.cs file that was generated using a code gen tool.

I am marking the class as a partial class, so I can create another file with my own hand written datalayer code.

How should I name my files?

Should I do it like this:

/data/partial/datalayer.cs /data/datalayer.cs

So when I run my codegenerator again, I just dump the file to the /partial/ folder in my source tree.

suggestions?

Upvotes: 0

Views: 442

Answers (3)

Kent Boogaart
Kent Boogaart

Reputation: 178660

VS uses a Filename.Designer.cs convention for generated files. You might do something similar. For example, you might have DataLayer.cs and DataLayer.Generated.cs. I personally would keep the files next to each other in the same directory to aid in discoverability.

Upvotes: 3

JaredPar
JaredPar

Reputation: 754745

I personally use ClassName_Generated.cs for generated files. I personally prefer an _ to a . for the generated separator.

Upvotes: 0

ChrisW
ChrisW

Reputation: 56113

Partial classes which are generated by the IDE when you create a Windows.Form are named like:

/mydirectory/MyFormName.cs
/mydirectory/MyFormName.Designer.cs

So I'd suggest like:

/mydirectory/datalayer.cs
/mydirectory/datalayer.autocodegen.cs

Upvotes: 1

Related Questions