I want to create a 1x N mapping using the fluent API Entity Framework , something like: a shopping cart has several products.
In my cart class, I have a navigation property , which is a collection of products:
public class Produto
{
//Atributos do produto
}
public class Carrinho
{
//Outros atributos da classe
public virtual IEnumerable<Produto> Produtos { get; set; }
}
This same navigation property could be modeled as a ICollection
:
public class Carrinho
{
//Outros atributos da classe
public virtual ICollection<Produto> Produtos { get; set; }
}
My question is: what is the difference between the two approaches?