/// <summary> /// Load recipe object from entity. /// </summary> private IProductRecipe LoadRecipe(IUnitOfWork uow, ProductRecipeEntity recipeEntity) { var productRecipe = RecipeConstructors[recipeEntity.Type](); RecipeStorage.CopyToRecipe(recipeEntity, productRecipe); productRecipe.Product = LoadType(uow, productRecipe.Product.Id); RecipeStrategies[recipeEntity.Type].LoadRecipe(recipeEntity, productRecipe); return(productRecipe); }
/// <summary> /// Copy properties to recipe /// </summary> /// <param name="recipeEntity"></param> /// <param name="productRecipe"></param> public static void CopyToRecipe(ProductRecipeEntity recipeEntity, IProductRecipe productRecipe) { productRecipe.Id = recipeEntity.Id; productRecipe.Name = recipeEntity.Name; productRecipe.Classification = (RecipeClassification)recipeEntity.Classification; productRecipe.Revision = recipeEntity.Revision; productRecipe.State = (RecipeState)recipeEntity.State; productRecipe.Product = new ProductReference(recipeEntity.ProductId); var workplanRecipe = productRecipe as IWorkplanRecipe; if (workplanRecipe != null) { workplanRecipe.Workplan = LoadWorkplan(recipeEntity.Workplan); } }