Entity Framework 4 custom data type

I am starting to use Entity Framework 4. I assume that I cannot change the database fields. I have a DateAdded field that is stored as YYYYMMDD and I would like to have entity.DateAdded as a DateTime type. This will simplify the work.

Is there a way to make my own column data type mapping? or any workarounds?

+4
source share
1 answer

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

namespace TheNamespace { public partial class TheEntity { public DateTime DateAdded { get { } set { } } } } 
+1
source

Source: https://habr.com/ru/post/1342660/


All Articles