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 store the property CustomerAtrributes
in the database to be easily retrieved 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'm using EntityFramework 6 to store my objects in the database using the CodeFirst approach.
EDIT: A friend found a possible duplicate : ef 5 codefirst enum collection not generated in database .But please, if you have any different ideas or workarounds, post them.