2017-09-01 08:55:02 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Hangfire;
|
2018-02-17 20:34:59 +00:00
|
|
|
|
using Hangfire.MemoryStorage;
|
2017-09-01 08:55:02 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace YTManager {
|
2017-09-03 07:00:16 +00:00
|
|
|
|
public class Startup {
|
|
|
|
|
public Startup(IConfiguration configuration) {
|
2017-09-01 08:55:02 +00:00
|
|
|
|
Configuration = configuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
|
|
2017-09-03 07:00:16 +00:00
|
|
|
|
// ID for periodic job to update all channels.
|
|
|
|
|
public static string periodicupdatejobID { get; } = "2013066213";
|
|
|
|
|
|
2017-09-01 08:55:02 +00:00
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
2017-09-03 07:00:16 +00:00
|
|
|
|
public void ConfigureServices(IServiceCollection services) {
|
2017-09-01 08:55:02 +00:00
|
|
|
|
services.AddMvc();
|
2018-02-17 20:34:59 +00:00
|
|
|
|
services.AddHangfire(x => x.UseMemoryStorage());
|
|
|
|
|
services.AddDbContext<MediaDB>(options => options.UseInMemoryDatabase(databaseName: "testdb"));
|
2017-09-01 08:55:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
2017-09-03 07:00:16 +00:00
|
|
|
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env) {
|
2017-09-01 08:55:02 +00:00
|
|
|
|
if (env.IsDevelopment())
|
|
|
|
|
app.UseDeveloperExceptionPage();
|
|
|
|
|
|
|
|
|
|
app.UseDefaultFiles();
|
|
|
|
|
app.UseStaticFiles();
|
|
|
|
|
app.UseMvc();
|
|
|
|
|
app.UseHangfireServer();
|
|
|
|
|
app.UseHangfireDashboard();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|