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 { }
}
}
}
精彩评论