EntityFramework: Access dabase-column using user defined Type
- by Nils
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 ?