EntityFramework: Access dabase-column using user defined Type

Posted by Nils on Stack Overflow See other posts from Stack Overflow or by Nils
Published on 2010-06-14T14:29:13Z Indexed on 2010/06/14 14:32 UTC
Read the original article Hit count: 232

I "inherited" an old Database where dates are stored as Int32 values (times too, but dates shall suffice for this example) i.e. 20090101 for Jan. 1st 2009. I can not change the schema of this database because it is still accessed by the old programs.
However I want to write a new program using EF as the O/R-M.
Now I'd love to have DateTime-Values in my Model.

Is there a way to write a custom type and use this as a Type in the EF-Model.

Something like a Type "OldDate" with properties: DatabaseValue : Int23 Value : DateTime (specifying the date-part whereas the time-part is always 0:00:00)

Is something like this possible with the EF-Model ?

© Stack Overflow or respective owner

Related posts about entity-framework

Related posts about datatypes