I am modifying the "ADO.NET POCO Entity Generat开发者_如何学JAVAor" template to create my own POCO classes. My .tt file for my Model is called Model1.tt. When you expand Model1.tt you will see a file called Model1.cs, which contains some auto-generated "Fixup" code:
public class FixupCollection<T> : ObservableCollection<T>
{
//Auto-generated code here
}
I don't need this Model1.cs file. Is it possible to modify the Model1.tt file so that it won't create the Model1.cs file at all?
Not sure how to completely remove the file, but to remove the FixupCollection
class you can just remove or comment out WriteCustomObservableCollection();
. Note that you will have to modify the part of the template that generates the FixupCollection
s for your POCO navigation properties too.
Had the same issue - one solution is to utilize the class itself as a base class, etc. Not exactly deleting it, I know, but I couldn't see a way to do it easily.
Files are created using the EntityFrameworkTemplateFileManager. On line #26 of tt file for types's you'll see it being initialized:
EntityFrameworkTemplateFileManager fileManager = EntityFrameworkTemplateFileManager.Create(this);
You'll see everywhere it's used just for searching for "fileManager" in the file.
精彩评论