c# - How to extend a class from Model.tt -
i've used c# in vs2012 linq connect simple sql database mdf file.
can see tables database classes in solution explorer, model1.edmx, model1.tt.
i want extend class , add features doesn't have constructor recognize, cant pass variables create objects.
is possible i'm trying?
thanks all
use partial classes. t4 templates generate classes partial classes can extend using partial classes.
so leave cs files generated t4 tool alone, , create cs files in same namespace , assembly classes this:
public partial class nameofclassint4 { //your own custom stuff here. }
yes, can have 2 partial classes same name, that's whole idea: define class in more 1 files. useful in case 1 definition auto generated , modifications might overwritten, create separate file , customize class in file if there in same file.
Comments
Post a Comment