mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
back to tiny for now
This commit is contained in:
parent
2912561d0e
commit
4deecde092
84 changed files with 617 additions and 558 deletions
|
@ -1,9 +1,11 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.AspNet.SignalR.Json;
|
||||
using NzbDrone.Common.Composition;
|
||||
|
||||
namespace NzbDrone.Api.SignalR
|
||||
{
|
||||
[Singleton]
|
||||
public class Serializer : IJsonSerializer
|
||||
{
|
||||
private readonly Common.IJsonSerializer _nzbDroneSerializer;
|
||||
|
@ -35,7 +37,7 @@ namespace NzbDrone.Api.SignalR
|
|||
{
|
||||
return _nzbDroneSerializer.Deserialize(json, targetType);
|
||||
}
|
||||
|
||||
|
||||
return _signalRSerializer.Parse(json, targetType);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,37 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.AspNet.SignalR;
|
||||
using Microsoft.AspNet.SignalR.Json;
|
||||
using TinyIoC;
|
||||
using NzbDrone.Common.Composition;
|
||||
|
||||
namespace NzbDrone.Api.SignalR
|
||||
{
|
||||
public class SignalrDependencyResolver : DefaultDependencyResolver
|
||||
{
|
||||
private readonly TinyIoCContainer _container;
|
||||
private readonly IContainer _container;
|
||||
|
||||
public static void Register(TinyIoCContainer container)
|
||||
public static void Register(IContainer container)
|
||||
{
|
||||
GlobalHost.DependencyResolver = new SignalrDependencyResolver(container);
|
||||
|
||||
container.Register<IJsonSerializer, Serializer>().AsSingleton();
|
||||
}
|
||||
|
||||
private SignalrDependencyResolver(TinyIoCContainer container)
|
||||
private SignalrDependencyResolver(IContainer container)
|
||||
{
|
||||
_container = container;
|
||||
}
|
||||
|
||||
public override object GetService(Type serviceType)
|
||||
{
|
||||
return _container.CanResolve(serviceType) ? _container.Resolve(serviceType) : base.GetService(serviceType);
|
||||
}
|
||||
if (_container.IsTypeRegistered(serviceType))
|
||||
{
|
||||
return _container.Resolve(serviceType);
|
||||
}
|
||||
|
||||
public override IEnumerable<object> GetServices(Type serviceType)
|
||||
{
|
||||
var objects = _container.CanResolve(serviceType) ? _container.ResolveAll(serviceType) : new object[] { };
|
||||
return objects.Concat(base.GetServices(serviceType));
|
||||
return base.GetService(serviceType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue