c# - Does anyone know what's happened with EF6 and AutoMapper for enum conversion -
There is a problem where I updated an application from EF4.1 to 6.0.2 to take advantage of the forwarding migration is. But after updating the automaker, it now fails to convert an ID into an ANIM, then I use the following code and its work for a long time.
Mapper Creativepant & lt; Payments, lists & gt; (). For Mail (x = & gt; x.PaymentStatus, opt = & gt; opt.MapFrom (s => Enum.GetName (PaymentStatus, s.PaymentStatusId)))
< / Pre>What's New
Edit: >
< / P> P>I'm having the following error:
Exception description: System.Data.SqlClient.SqlException: Invalid column name 'PaymentStatus'
and being converted into a DTO object with the following:
Public Ink Acceptance Status {Received; Set; } Public Virtual Approval Status acceptance status {get; Set; }
Cheers
OK I have done this. [NotMapped ] .
Then the following similar functionality will be given in my case, because earlier Enum support was introduced with the unit framework 5
public int ApprovalStatusId {get; Set; } [NotMapped] Public Virtual ApprovalStats Approval Status {get; Set; }
For those who want to declare an enum in an EF5 + entity model, you just have to declare an enumeration in the model, if I start this model in the future I want to remove my int payment statusId from my model, and also remove the virtual keyword from the acceptance status as it becomes useless in this situation.
Public Approval Status Acceptance Status {Received; Set; }
The database will store the int value of the anonymous in the Datastor column of the acceptance status.
All cheers.
Comments
Post a Comment