cli now building against Yavsc

This commit is contained in:
2018-04-20 16:16:54 +02:00
parent e8888407e9
commit b0c79ece68
8 changed files with 3223 additions and 132 deletions

View File

@ -16,7 +16,7 @@ using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
// using Microsoft.AspNet.Localization;
using Microsoft.AspNet.Localization;
using Microsoft.AspNet.Mvc;
using Microsoft.AspNet.Mvc.Filters;
using Microsoft.AspNet.Mvc.Razor;
@ -35,15 +35,13 @@ namespace cli
var host = new WebHostBuilder();
var hostengnine = host.UseEnvironment("Develpment")
.UseServer("Yavsc.Server")
.UseServer("cli")
.UseStartup<Startup>()
/*
.UseServices(services => {
Console.WriteLine($"> Using {services.Count} services:");
foreach (var s in services) Console.WriteLine($"> * {s.ServiceType}");
} )
*/
Console.WriteLine($"> Using {services.Count} services:");
foreach (var s in services) Console.WriteLine($"> * {s.ServiceType}");
})
.Build();
var app = hostengnine.Start();
@ -93,7 +91,6 @@ namespace cli
services.Configure<SiteSettings>(siteSettingsconf);
var smtpSettingsconf = Configuration.GetSection("Smtp");
services.Configure<SmtpSettings>(smtpSettingsconf);
services.AddInstance(typeof(ILoggerFactory), new LoggerFactory());
services.AddTransient(typeof(IEmailSender), typeof(MessageSender));
services.AddTransient(typeof(RazorEngineHost), typeof(YaRazorEngineHost));
@ -107,6 +104,10 @@ namespace cli
services.AddLogging();
services.AddTransient<EMailer>();
services.AddLocalization(options =>
{
options.ResourcesPath = "Resources";
});
}
public void Configure (IApplicationBuilder app, IHostingEnvironment env,

24
cli/YavscServerFactory.cs Normal file
View File

@ -0,0 +1,24 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Hosting.Server;
using Microsoft.AspNet.Http.Features;
using Microsoft.Extensions.Configuration;
using Yavsc.Models;
namespace Yavsc.Server
{
public class YavscServerFactory : IServerFactory
{
public IFeatureCollection Initialize(IConfiguration configuration)
{
FeatureCollection featureCollection = new FeatureCollection();
return featureCollection;
}
public IDisposable Start(IFeatureCollection serverFeatures, Func<IFeatureCollection, Task> application)
{
var task = application(serverFeatures);
return task;
}
}
}

View File

@ -25,7 +25,7 @@
"Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final",
"Microsoft.Framework.Configuration.Json": "1.0.0-*",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-*",
"Yavsc": "1.0.5-rc9",
"Yavsc": { "type": "build", "target": "project" },
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final"
},

File diff suppressed because it is too large Load Diff