|
|
|
|
@ -3,22 +3,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using System.Runtime.Versioning;
|
|
|
|
|
using Microsoft.AspNet.Builder.Internal;
|
|
|
|
|
using Yavsc.Services;
|
|
|
|
|
using Google.Apis.Util.Store;
|
|
|
|
|
using cli_2;
|
|
|
|
|
using Microsoft.Extensions.PlatformAbstractions;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.AspNet.Builder.Internal;
|
|
|
|
|
using Microsoft.AspNet.Hosting;
|
|
|
|
|
using Yavsc.Models;
|
|
|
|
|
using Microsoft.AspNet.Identity.EntityFramework;
|
|
|
|
|
using Microsoft.Extensions.OptionsModel;
|
|
|
|
|
using Microsoft.AspNet.Hosting.Builder;
|
|
|
|
|
using Microsoft.AspNet.Hosting.Internal;
|
|
|
|
|
using Microsoft.AspNet.Server;
|
|
|
|
|
|
|
|
|
|
using Microsoft.AspNet.Identity.EntityFramework;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using Microsoft.Extensions.OptionsModel;
|
|
|
|
|
using Microsoft.Extensions.PlatformAbstractions;
|
|
|
|
|
using Yavsc;
|
|
|
|
|
using Microsoft.AspNet.Hosting.Internal;
|
|
|
|
|
using Yavsc.Models;
|
|
|
|
|
|
|
|
|
|
using Yavsc.Services;
|
|
|
|
|
using cli_2;
|
|
|
|
|
|
|
|
|
|
public class Program
|
|
|
|
|
{
|
|
|
|
|
@ -27,13 +29,19 @@ public class Program
|
|
|
|
|
|
|
|
|
|
public Program()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ConfigureServices(new ServiceCollection());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ConfigureServices(IServiceCollection services, string environmentName="Development")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
IHostingEnvironment hosting = new HostingEnvironment{ EnvironmentName = environmentName };
|
|
|
|
|
|
|
|
|
|
services.Add(new ServiceDescriptor(typeof(IHostingEnvironment), hosting ));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
services.AddLogging();
|
|
|
|
|
|
|
|
|
|
services.AddOptions();
|
|
|
|
|
@ -55,9 +63,9 @@ public class Program
|
|
|
|
|
|
|
|
|
|
services.AddIdentity<ApplicationUser,IdentityRole>();
|
|
|
|
|
var basePath = AppDomain.CurrentDomain.BaseDirectory;
|
|
|
|
|
// FIXME null ref var appName = AppDomain.CurrentDomain.ApplicationIdentity.FullName;
|
|
|
|
|
// FIXME null ref var appName = AppDomain.CurrentDomain.ApplicationIdentity.FullName;
|
|
|
|
|
|
|
|
|
|
// var rtdcontext = new System.Runtime.DesignerServices.WindowsRuntimeDesignerContext (new string { "." }, "nonname");
|
|
|
|
|
// var rtdcontext = new WindowsRuntimeDesignerContext (new string [] { "../Yavsc" }, "Yavsc");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
serviceProvider = services.BuildServiceProvider();
|
|
|
|
|
@ -75,10 +83,9 @@ public class Program
|
|
|
|
|
// needs a logger factory ...
|
|
|
|
|
var loggerFactory = serviceProvider
|
|
|
|
|
.GetService<ILoggerFactory>()
|
|
|
|
|
.AddConsole(LogLevel.Debug);
|
|
|
|
|
.AddConsole(LogLevel.Verbose);
|
|
|
|
|
startup = new Startup (hosting, appEnv);
|
|
|
|
|
|
|
|
|
|
startup = new Startup (hosting, appEnv);
|
|
|
|
|
startup.ConfigureServices(services);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ApplicationBuilderFactory applicationBuilderFactory
|
|
|
|
|
@ -86,11 +93,13 @@ public class Program
|
|
|
|
|
|
|
|
|
|
var builder = applicationBuilderFactory.CreateBuilder(null);
|
|
|
|
|
|
|
|
|
|
startup.ConfigureServices(services);
|
|
|
|
|
|
|
|
|
|
IOptions<SiteSettings> siteSettings = serviceProvider.GetService(typeof(IOptions<SiteSettings>)) as IOptions<SiteSettings>;
|
|
|
|
|
builder.ApplicationServices = serviceProvider;
|
|
|
|
|
IOptions<SiteSettings> siteSettings = serviceProvider.GetService(typeof(IOptions<SiteSettings>)) as IOptions<SiteSettings>;
|
|
|
|
|
IOptions<SmtpSettings> smtpSettings = serviceProvider.GetService(typeof(IOptions<SmtpSettings>)) as IOptions<SmtpSettings>;
|
|
|
|
|
|
|
|
|
|
startup.Configure(builder,siteSettings,smtpSettings);
|
|
|
|
|
startup.Configure(builder, loggerFactory, siteSettings, smtpSettings);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|