Using partial classes for autogenous code, setting files, etc.?

I have a datalayer.cs file that was generated with a code generation tool.

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

How do I name my files?

Should I do it like this:

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

So when I run my replacement code again, I just dump the file into the / partial / folder in my source tree.

offers?

0


source to share


3 answers


VS uses the Filename.Designer.cs convention for the generated files. You can do something like this. For example, you might have DataLayer.cs and DataLayer.Generated.cs. I will personally keep the files next to each other in the same directory to aid detection.



+3


source


The partial classes that the IDE generates when the Windows.Form is created are named:

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

      



So I would suggest:

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

      

+1


source


I personally use ClassName_Generated.cs for the generated files. I personally prefer a. for the generated delimiter.

0


source







All Articles