示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
 public BakeryController(TMDTContext context, IBakery bakeryRepository)
 {
     _repository = bakeryRepository;
     _context    = context;
 }
示例#4
0
 public GPUAnimDrawer(IBakery bakery, IConfig config)
 {
     this.data   = bakery.BakeClips(config.FrameRate);
     this.config = config;
 }
示例#5
0
 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;
 }
示例#7
0
 protected Decorator(IBakery bakery)
 {
     _bakery = bakery;
 }
 public BakeryShopAdapter(IBakery bakery)
 {
     _bakery = bakery;
 }
示例#9
0
 public BurritoShop(IBakery bakery, IButcher butcher)
 {
     this.bakery  = bakery;
     this.butcher = butcher;
 }
示例#10
0
 public Delivery(IBakery b)
 {
     bakery = b;
 }
 public BakeryController(ILogger <BakeryController> logger, IBakery ibakery)
 {
     _logger  = logger;
     _ibakery = ibakery;
 }
示例#12
0
 public Type2(IBakery bakery) : base(bakery)
 {
     bake = "Type 2"; price = 2;
 }
示例#13
0
 public Type1(IBakery bakery) : base(bakery)
 {
     bake = "Type 1"; price = 1;
 }