I have this class
public class Client
{
public int Id { get; set; }
public ICollection<Recipe> Recipes { get; set; }
public ICollection<Recipe> Favorites { get; set; }
}
that has 2 1 to many relationship with the recipe class
public class Recipe
{
public int Id { get; set; }
public int ClientId { get; set; }
public Client Client { get; set; }
}
How can I describe these two relationships? do I need an extra class (favorite)?
Thanks for the help.
EDIT:
I should've been more clear. Client.Recipes is the recipes the client actually owns:
modelBuilder.Entity<Client>()
.HasMany(c => c.Recipes)
.WithRequired(r => r.Client)
.HasForeignKey(r => r.ClientId);
the problem with Client.Favorites is that it doesn't own them thus Recipe.ClientId is invalid for this particular relationship. I need a relational table for this, ut do I need to express it in a class or can it be expressed in Fluent Api? If yes, how?
Sorry if I wasn't explicit at first.