I'm using EF 6.0 and ASP.NET MVC with C# and I have two classes - project
and feature
:
public class project
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public Guid id { get; set; }
[Required]
public string aliasName { get; set; }
public virtual List<feature> features { get; set; }
}
and
public class feature
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int id { get; set; }
[Required]
public string name { get; set; }
[DataType(DataType.MultilineText)]
public string description { get; set; }
}
The end-user will pick more than one feature per project, and each project can contain different features.
How can I setup this in EF and store this selection in db?
In dbContext
I have at this moment:
public DbSet<project> Projects { get; set; }
public DbSet<feature> Features { get; set; }