Answer the question
In order to leave comments, you need to log in
Is it possible to add logic to the properties that are used in CodeFirst EF6?
Is it possible to use properties in this way to generate a database in EF6?
private ICollection<Ingredient> ingredients;
public virtual ICollection<Ingredient> Ingredients
{
get => ingredients ?? (ingredients= new List<Ingredient>());
set
{
if (value == null)
throw new ArgumentNullException("Ingredients");
else if (value.Count() <= 0)
throw new ArgumentOutOfRangeException("Ingredients");
ingredients = value;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question