EntityFramework how to Override properties
Posted
by plotnick
on Stack Overflow
See other posts from Stack Overflow
or by plotnick
Published on 2010-03-24T20:58:46Z
Indexed on
2010/03/26
23:03 UTC
Read the original article
Hit count: 199
entity-framework
|entity
I've just started using EF in VS2010. That thing is just amazin'.
I frankly can't understand something. For example I have EntityType with property, they generated from database structure. Now, I have to simply override that property in my code. I don't need to save value of the property back into DB, but everytime when it gets read from DB it should be substituted with run-time calculated value.
Of course I can create derived class based on my EntityType but I've tried and found kinda difficulties, I'm not sure this is kinda right way to do. Anyway even when I try to change the whole EntityType to Abstract, damn Visual Studio doesn't want to validate that and says something like:
"Error 2078: The EntityType 'AssetsModel.Asset' is Abstract and can be mapped only using IsTypeOf." "Error 2063: At least one property must be mapped in the set mapping for 'Assets'"
What the hell is this suppose to mean I dunno..
Any ideas gentlemen?
© Stack Overflow or respective owner