public BoardGameDemos(ILoggerFactory loggerFactory, IBoardGameManager boardGameManager) { if (null == loggerFactory) { throw new ArgumentNullException(ErrorMessageILoggerFactoryWrapperIsNull, (Exception)null); } this.logger = loggerFactory.CreateLogger <BoardGameDemos>(); this.boardGameManager = boardGameManager ?? throw new ArgumentNullException(ErrorMessageIBoardGameManagerIsNull, (Exception)null); }
public CollectionController(IMemoryCache cache, IConfiguration configuration, IBoardGameManager boardGameManager) { _cache = cache; _configuration = configuration; _boardGameManager = boardGameManager; }
public static int Main(string[] args) { ILog lgr = LogManager.GetLogger(typeof(Program)); try { /* look at the Project-Properties/Debug(Tab) for this environment variable */ string environmentName = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); Console.WriteLine(string.Format("ASPNETCORE_ENVIRONMENT='{0}'", environmentName)); Console.WriteLine(string.Empty); IConfigurationBuilder builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{environmentName}.json", true, true) .AddEnvironmentVariables(); IConfigurationRoot configuration = builder.Build(); string defaultConnectionStringValue = configuration.GetConnectionString("DefaultConnection"); Console.WriteLine(string.Format("defaultConnectionStringValue='{0}'", defaultConnectionStringValue)); Console.WriteLine(string.Empty); ////setup our DI IServiceCollection servColl = new ServiceCollection() .AddSingleton(lgr) .AddLogging() .AddSingleton <IBoardGameManager, BoardGameManager>() .AddSingleton <IUsaStateDefinitionConfigurationRetriever, UsaStateDefinitionConfigurationRetriever>() .AddSingleton <IUsaStateDefinitionFinder, UsaStateDefinitionFinder>() .AddSingleton(configuration); ServiceProvider servProv = servColl.BuildServiceProvider(); CustomConfiguration.Domain.FosterExample.AppConfig my7AppConfig = configuration.Get <CustomConfiguration.Domain.FosterExample.AppConfig>(); ////UsaStateConfigurationWrapperThisObjectNameDoesNotReallyMatter myUsaStateDefinitionConfigurationSectionName = configuration.Get<UsaStateConfigurationWrapperThisObjectNameDoesNotReallyMatter>(); IUsaStateDefinitionConfigurationRetriever customConfigRetriever = servProv.GetService <IUsaStateDefinitionConfigurationRetriever>(); UsaStateConfigurationWrapperThisObjectNameDoesNotReallyMatter myUsaStateDefinitionConfigurationSectionName = customConfigRetriever.GetUsaStateConfigurationWrapperThisObjectNameDoesNotReallyMatter(); if (null != myUsaStateDefinitionConfigurationSectionName) { ShowUsaStateObjects("configuration.Get", myUsaStateDefinitionConfigurationSectionName.UsaStateDefinitions); } Console.WriteLine(string.Empty); IUsaStateDefinitionFinder finder = servProv.GetService <IUsaStateDefinitionFinder>(); UsaStateObject foundUsaStateObject = finder.FindUsaStateObject("Virginia"); ShowUsaStateObject("FindUsaStateObject:(ByVirginia)", foundUsaStateObject); Console.WriteLine(string.Empty); IBoardGameManager boardGameManager = servProv.GetService <IBoardGameManager>(); boardGameManager.DemonstrateIUsaStateDefinitionConfigurationRetriever(); Console.WriteLine(string.Empty); boardGameManager.DemonstrateIUsaStateDefinitionFinder(); Console.WriteLine(string.Empty); } catch (Exception ex) { string flattenMsg = GenerateFullFlatMessage(ex, true); Console.WriteLine(flattenMsg); } Console.WriteLine("Press ENTER to exit"); Console.ReadLine(); return(0); }
public HomeController(IUnitOfWork unitOfWork, IBoardGameGeekInfoManager bggInfoManager, IBoardGameManager boardGameManager) { this.unitOfWork = unitOfWork; this.bggInfoManager = bggInfoManager; this.boardGameManager = boardGameManager; }