Removed the other rootpath provider

pull/470/head
TidusJar 8 years ago
parent 57442f16d8
commit 8b46925f08

@ -25,6 +25,7 @@
// ************************************************************************/
#endregion
using System.Diagnostics;
using System.Net;
using Mono.Data.Sqlite;
@ -68,12 +69,14 @@ namespace PlexRequests.UI
private IKernel _kernel;
protected override IKernel GetApplicationContainer()
{
Debug.WriteLine("GetAppContainer");
_kernel.Load<FactoryModule>();
return _kernel;
}
protected override void ApplicationStartup(IKernel container, IPipelines pipelines)
{
Debug.WriteLine("Bootstrapper.ApplicationStartup");
ConfigureContainer(container);
JsonSettings.MaxJsonLength = int.MaxValue;
@ -116,14 +119,18 @@ namespace PlexRequests.UI
#endif
protected override void ConfigureConventions(NancyConventions nancyConventions)
{
Debug.WriteLine("Configuring the conventions");
base.ConfigureConventions(nancyConventions);
Debug.WriteLine("Finished BASE");
var settingsService = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
var settings = settingsService.GetSettings();
var assetLocation = settings.BaseUrl ?? string.Empty;
var settings = new SettingsServiceV2<PlexRequestSettings>(new SettingsJsonRepository(new DbConfiguration(new SqliteFactory()), new MemoryCacheProvider()));
var assetLocation = settings.GetSettings().BaseUrl;
Debug.WriteLine($"AssetLocation {assetLocation}");
nancyConventions.StaticContentsConventions.Add(
StaticContentConventionBuilder.AddDirectory($"{assetLocation}/Content_{AssemblyHelper.GetProductVersion()}", "Content")
);
Debug.WriteLine("Added Content");
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/docs", "swagger-ui");
nancyConventions.StaticContentsConventions.AddDirectory($"{assetLocation}/fonts", "Content/fonts");
@ -166,6 +173,7 @@ namespace PlexRequests.UI
protected override void RequestStartup(IKernel container, IPipelines pipelines, NancyContext context)
{
Debug.WriteLine("RequestStartup");
//CORS Enable
pipelines.AfterRequest.AddItemToEndOfPipeline((ctx) =>
{
@ -179,6 +187,7 @@ namespace PlexRequests.UI
private void ConfigureContainer(IKernel container)
{
Debug.WriteLine("Configuring ServiceLoc/Container");
var loc = ServiceLocator.Instance;
loc.SetContainer(container);
}

@ -26,6 +26,7 @@
#endregion
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
@ -43,10 +44,16 @@ namespace PlexRequests.UI.Helpers
/// </summary>
public IEnumerable<IBinding> Resolve(Multimap<Type, IBinding> bindings, Type service)
{
Debug.WriteLine("Contrar thing");
if (service.IsGenericType)
{
var genericType = service.GetGenericTypeDefinition();
var genericArguments = genericType.GetGenericArguments();
if (!genericArguments.Any())
{
return Enumerable.Empty<IBinding>();
}
if (genericArguments.Length == 1 && genericArguments.Single().GenericParameterAttributes.HasFlag(GenericParameterAttributes.Contravariant))
{
var argument = service.GetGenericArguments().Single();

@ -25,7 +25,7 @@
// ************************************************************************/
#endregion
using System;
using System.Diagnostics;
using Ninject;
using Ninject.Planning.Bindings.Resolvers;
@ -47,13 +47,24 @@ namespace PlexRequests.UI
{
try
{
Debug.WriteLine("Starting StartupConfiguration");
var resolver = new DependancyResolver();
Debug.WriteLine("Created DI Resolver");
var modules = resolver.GetModules();
Debug.WriteLine("Getting all the modules");
Debug.WriteLine("Modules found finished.");
var kernel = new StandardKernel(modules);
Debug.WriteLine("Created Kernel and Injected Modules");
Debug.WriteLine("Added Contravariant Binder");
kernel.Components.Add<IBindingResolver, ContravariantBindingResolver>();
Debug.WriteLine("Start the bootstrapper with the Kernel.ı");
app.UseNancy(options => options.Bootstrapper = new Bootstrapper(kernel));
Debug.WriteLine("Finished bootstrapper");
var scheduler = new Scheduler();
scheduler.StartScheduler();
}

Loading…
Cancel
Save