예제 #1
0
 public GiphyTools(GiphyConfig giphyConfig, ILogger <GiphyTools> logger, IWebTools webTools)
 {
     _apiKey   = giphyConfig.ApiKey;
     _giphyUrl = giphyConfig.GiphyUrl;
     _webTools = webTools;
     _logger   = logger;
 }
예제 #2
0
 public GiphyController(GiphyContext context, IConfiguration configuration,
                        IGiphyTools giphyTools, GiphyConfig giphyConfig, IMemoryCache memoryCache)
 {
     _giphyConfig  = giphyConfig;
     Configuration = configuration;
     _context      = context;
     _giphyTools   = giphyTools;
     _cache        = memoryCache;
 }
예제 #3
0
 public GiphyController(ILogger <GiphyController> logger, IConfiguration configuration,
                        IGiphyTools giphyTools, GiphyConfig giphyConfig, IMemoryCache memoryCache)
 {
     _logger       = logger;
     _giphyConfig  = giphyConfig;
     Configuration = configuration;
     _giphyTools   = giphyTools;
     _cache        = memoryCache;
 }
예제 #4
0
        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);
        }
예제 #5
0
        // 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>();
        }
예제 #6
0
        // 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>();
        }
예제 #7
0
 public GiphyTools(GiphyConfig giphyConfig)
 {
     _apiKey   = giphyConfig.ApiKey;
     _giphyUrl = giphyConfig.GiphyUrl;
 }