public GiphyTools(GiphyConfig giphyConfig, ILogger <GiphyTools> logger, IWebTools webTools) { _apiKey = giphyConfig.ApiKey; _giphyUrl = giphyConfig.GiphyUrl; _webTools = webTools; _logger = logger; }
public GiphyController(GiphyContext context, IConfiguration configuration, IGiphyTools giphyTools, GiphyConfig giphyConfig, IMemoryCache memoryCache) { _giphyConfig = giphyConfig; Configuration = configuration; _context = context; _giphyTools = giphyTools; _cache = memoryCache; }
public GiphyController(ILogger <GiphyController> logger, IConfiguration configuration, IGiphyTools giphyTools, GiphyConfig giphyConfig, IMemoryCache memoryCache) { _logger = logger; _giphyConfig = giphyConfig; Configuration = configuration; _giphyTools = giphyTools; _cache = memoryCache; }
static Config() { if (!Directory.Exists(KConfigFolder)) { Directory.CreateDirectory(KConfigFolder); } DiscordBotConfig = Setup <DiscordConfig>(KConfigFolder + "/" + KDiscord_ConfigFile); TwitterBotConfig = Setup <TwitterConfig>(KConfigFolder + "/" + KTwitter_ConfigFile); GiphyBotConfig = Setup <GiphyConfig> (KConfigFolder + "/" + KGiphy_ConfigFile); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddEntityFrameworkInMemoryDatabase(). AddDbContext <GiphyContext>(opt => opt.UseInMemoryDatabase("GiphyList")); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); GiphyConfig giphyConfig = new GiphyConfig(); Configuration.GetSection("Giphy").Bind(giphyConfig); //Create singleton from instance services.AddSingleton <IGiphyTools, GiphyTools>(); services.AddSingleton(giphyConfig); // Register custom application dependencies. //services.AddScoped<IMyCustomRepository, MyCustomSQLRepository>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(o => o.AddPolicy("MyPolicy", builder => { builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); })); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); GiphyConfig giphyConfig = new GiphyConfig(); Configuration.GetSection("Giphy").Bind(giphyConfig); //Create singleton from instance services.AddSingleton <IGiphyTools, GiphyTools>(); services.AddSingleton <IWebTools, WebTools>(); services.AddSingleton(giphyConfig); // Register custom application dependencies. //services.AddScoped<IMyCustomRepository, MyCustomSQLRepository>(); }
public GiphyTools(GiphyConfig giphyConfig) { _apiKey = giphyConfig.ApiKey; _giphyUrl = giphyConfig.GiphyUrl; }