예제 #1
0
        public RecipeController(IRecipeProvider recipeProvider, ICategoryProvider categoryProvider, IIngridientProvider ingridientProvider)
        {
            ProvidersFactory factory = new ProvidersFactory();

            if (recipeProvider != null)
            {
                _recipeProvider = recipeProvider;
            }
            else
            {
                _recipeProvider = factory.GetRecipeProvider();
            }

            if (categoryProvider != null)
            {
                _categoryProvider = categoryProvider;
            }
            else
            {
                _categoryProvider = factory.GetCategoryProvider();
            }

            if (ingridientProvider != null)
            {
                _ingridientProvider = ingridientProvider;
            }
            else
            {
                _ingridientProvider = factory.GetIngridientProvider();
            }
        }
예제 #2
0
 public IngridientController(IIngridientProvider ingridientProvider)
 {
     if (ingridientProvider != null)
     {
         _ingridientProvider = ingridientProvider;
     }
     else
     {
         ProvidersFactory factory = new ProvidersFactory();
         _ingridientProvider = factory.GetIngridientProvider();
     }
 }