开发者

Entity Framework 4 custom Data type

I am starting to use Entity Framework 4. assuming I can not change the database fields. I have a field DateAdded that is stored as YYYYMMD开发者_开发技巧D and I would like to have the entity.DateAdded as a DateTime type. It would make it much easier to work with.

Is there a way to do a custom column data type mapping? or any workarounds?


You could add an additional property in a partial class for the entity that wraps the "raw" property.

namespace TheNamespace
{

  public partial class TheEntity
  {
      public DateTime DateAdded 
      {
         get {  }
         set {  }
      }
  }
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜