开发者

A Truncated CreateObject()?

MSDN documentation says:

When working with the Entity Framework generated classes, consider using the entity type's static CreateObjectName method to create a new instance of an entity type. The Enti开发者_开发知识库ty Data Model tools include this method in each class when they generate the entity types. This create method is used to create an instance of an object and set all the properties of the class that cannot be null. The method includes a parameter for every property that has the Nullable="false" attribute applied in the CSDL file.

However, I'm using T4 C# POCO Generator which evidently does not generate a Create ObjectName method for any entities. I'm surprised. Does anyone have a T4 template which does generate these methods to match what MSDN describes?


These methods are generated by default code generator and by ADO.NET EntityObject generator (T4 template). If you want it in T4 template for POCOs you must modify the template and write the code generation logic yourselves (or find it in EntityObjects' template).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜