简体   繁体   中英

How to map the datetime ms sql datatype into a custom .net type?

I'm using LINQ to SQL classes to create a model for my database entities. The Player class is mapped to the Players database table and one of the attributes of this table LastCheckDate is of type datetime. Normally to map a C# property to this attribute it has to be declared of type System.DateTime. I would like to use another another type when I declare this property. For example:

public IDateTimeWrap LastCheckDate { get; set; } 

How can this be accomplished ?

You could use custom Data Model Generation Template. For ex. this's for Entity Framework . I'm sure you can find same on Linq to Sql

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM