/// <summary> /// This constructor variation presets the context with a strategy. /// We can also mutate the Strategy at runtime by exposing setter method. /// </summary> /// <param name="strategy"></param> /// <param name="logger"></param> /// <param name="menuDatabase"></param> public RestaurantMenuContext( IMenuGenerationStrategy strategy, IApplicationLogger logger, IDatabase menuDatabase) { _strategy = strategy; _logger = logger; _menuDatabase = menuDatabase; // Connect and Seed the database with all possible menu items we can provide // We close the connection when we dispose of this Context. InitializeDatabase().Wait(); }
public void SetStrategy(IMenuGenerationStrategy strategy) { _strategy = strategy; }