示例#1
0
 private RecipeIngredient(Guid recipeId, Guid ingredientId, string name, IngredientCategory category,
                          string measure, float amount)
 {
     RecipeId     = recipeId;
     IngredientId = ingredientId;
     SetName(name);
     SetCategory(category);
     SetMeasure(measure);
     SetAmount(amount);
 }
示例#2
0
 private void SetCategory(IngredientCategory category)
 => Category = category ?? throw new CoreException(ErrorCode.EmptyModelProperty,
                                                   ErrorMessage.EmptyRecipeIngredientCategory);
示例#3
0
 public static Ingredient Create(string name, IngredientCategory category)
 => new Ingredient(name, category);
示例#4
0
 public void SetCategory(IngredientCategory category)
 => Category = Validate(category, ErrorCode.EmptyModelProperty, ErrorMessage.EmptyIngredientCategory);
示例#5
0
 private Ingredient(string name, IngredientCategory category)
 {
     SetName(name);
     SetCategory(category);
 }