I have a class with a property of type ICollection<Enum> .
Say, for example, we have the following enumeration :
public enum CustomerType { VIP, FrequentCustomer, BadCustomer }
We also have the following class:
public class Customer { public int Id { get;set; } public string FirstName { get;set; } public string LastName { get;set; } public ICollection<CustomerType> CustomerAtrributes { get;set; } }
How can I save the CustomerAtrributes property in the database, which will be easily restored later?
For example, I'm looking for something like the following:
CustomerId | FirstName | LastName | CustomerType | 1 | Bob | Smith | VIP | 1 | Bob | Smith | FrequentCustomer| 2 | Mike | Jordan | BadCustomer |
EDIT: I am using EntityFramework 6 to store my objects in a database using the CodeFirst approach.
EDIT: friend found a possible duplicate: ef 5 assembly of the codefirst enum code not created in the database . But, if you have different ideas or workarounds, post them,
source share