Can I use Data Annotations or Fluent to convert a value between data store and entity class?
- 阅读更多 关于 Can I use Data Annotations or Fluent to convert a value between data store and entity class?
问题 I am working with an existing [poorly designed] database which stores a dollar amount as an integer (ie. $10.99 == 1099) in the database. I want my entity class to treat this value as a decimal so that consuming code doesn't have to do the translation. Is there a way to convert the value to and from integer to decimal and then back using Data Annotations or Fluent configuration? In the meantime I am using a hack which essentially "wraps" the integer property with a decimal property that