Making sure that DateTime properties return DateTimeKind.Utc

后端 未结 3 1343
鱼传尺愫
鱼传尺愫 2021-01-01 05:15

Is it possible to define DateTime properties in entity objects that are of Kind == DateTimeKind.Utc by using either the .edmx file, or a t4 template?

W

3条回答
  •  情深已故
    2021-01-01 05:50

    Yes, it would be possible to use a custom T4 template.

    You'd just have to adjust your property setters and getters.

    It might be easier to attempt a POCO approach;

    For EF1: http://code.msdn.microsoft.com/EFPocoAdapter/Release/ProjectReleases.aspx?ReleaseId=1580

    For EF4: http://thedatafarm.com/blog/data-access/agile-entity-framework-4-repository-part-1-model-and-poco-classes/

提交回复
热议问题