public static void Main(string[] args) { BakeryFactory bakeryFactory = new BakeryFactory(); IBakery bakery = bakeryFactory.GetBakeryItem("Red"); Console.WriteLine(bakery); IBakery bakery2 = bakeryFactory.GetBakeryItem("Blue"); Console.WriteLine(bakery2); //Returns already present Muffin IBakery bakery3 = bakeryFactory.GetBakeryItem("Red"); Console.WriteLine(bakery3); }
public IBakery GetBakeryItem(string color) { bool present = bakeryObjects.TryGetValue(color, out item); if (!present) { Console.WriteLine("New Item prepared"); item = new Muffin(color); item.Make(); bakeryObjects[color] = item; } else { Console.WriteLine("Item Already Present"); } return(item); }
public BakeryController(TMDTContext context, IBakery bakeryRepository) { _repository = bakeryRepository; _context = context; }
public GPUAnimDrawer(IBakery bakery, IConfig config) { this.data = bakery.BakeClips(config.FrameRate); this.config = config; }
public Creamy(IBakery bakery) : base(bakery) { this.bake = "Creamy"; this.price = 500; }
public SpecialBake(IBakery bakery) : base(bakery) { this.bake = "Special Bake"; this.price = 50; }
protected Decorator(IBakery bakery) { _bakery = bakery; }
public BakeryShopAdapter(IBakery bakery) { _bakery = bakery; }
public BurritoShop(IBakery bakery, IButcher butcher) { this.bakery = bakery; this.butcher = butcher; }
public Delivery(IBakery b) { bakery = b; }
public BakeryController(ILogger <BakeryController> logger, IBakery ibakery) { _logger = logger; _ibakery = ibakery; }
public Type2(IBakery bakery) : base(bakery) { bake = "Type 2"; price = 2; }
public Type1(IBakery bakery) : base(bakery) { bake = "Type 1"; price = 1; }