Entity Framework Code First - Two tables, same concept, but different types

I have a database with two tables, one with a column numeric (19,4) and other with float. I need to map (in Entity Framework 5 Code First) this two tables in entities that have the same type, such as decimal. Change the database is the best solution, although is out of question. Anyone?


Entity Framework does not support such simple mappings (yet?) that require type conversions. It is on a feature request list but apparently not decided until now if simple type mappings will get better support in the future:


A workaround is to use two properties in your model, one that is not mapped to a database column and one with a type matching the actual type in the database, and then to perform the type conversion between the two properties in their getters and setters. An example for this is here:


Need Your Help

Share an image to specific apps

android eclipse android-image

I want to show a dialog with specific apps list and want to share my picture along with text message.

sql query for multi valued attributes

sql oracle

I have resources each represented by a guid and they have attribute name-value pairs. I would like to query