When using T4 classes for an entity framework, there are several developers who generate classes with one additional new line for each generated line. I am wondering if this is some parameter that needs to be changed so that their generated T4 files look like the generated files from other developers. As an example of what I'm talking about: (specific names removed, but you should see the difference in the number of new lines generated from the same * .tt file.)
( Update:) The problem also arises in other T4 templates, and not just in EF. Both computers use TextTemplatingFileGenerator as a custom T4 tool.)
T4 output from my PC:
public virtual DbSet<GeneratedObject1> GeneratedObject1 { get; set; } public virtual DbSet<GeneratedObject2> GeneratedObject2 { get; set; } public virtual int SomeMethod1(Nullable<int> inParameter) { var localParameter = inParameter.HasValue ? new ObjectParameter("SomePropertyName", inParameter) : new ObjectParameter("SomePropertyName", typeof(int)); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("SomeMethod1", localParameter); } public virtual int SomeMethod2(Nullable<int> inParameter) { var localParameter = inParameter.HasValue ? new ObjectParameter("SomePropertyName", inParameter) : new ObjectParameter("SomePropertyName", typeof(int)); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("SomeMethod2", localParameter); }
T4 is output from your PC:
public virtual DbSet<GeneratedObject1> GeneratedObject1 { get; set; } public virtual DbSet<GeneratedObject2> GeneratedObject2 { get; set; } public virtual int SomeMethod1(Nullable<int> inParameter) { var localParameter = inParameter.HasValue ? new ObjectParameter("SomePropertyName", inParameter) : new ObjectParameter("SomePropertyName", typeof(int)); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("SomeMethod1", localParameter); } public virtual int SomeMethod2(Nullable<int> inParameter) { var localParameter = inParameter.HasValue ? new ObjectParameter("SomePropertyName", inParameter) : new ObjectParameter("SomePropertyName", typeof(int)); return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction("SomeMethod2", localParameter); }
Edit:
(About the same text in the file.) My file: 
Their file: 
c # t4
Thomas927
source share