Mediator.Net.Unity by Yuan(Eddy) Ma

<PackageReference Include="Mediator.Net.Unity" Version="1.0.14" />

 UnityExtensioins

public class UnityExtensioins
using Mediator.Net.Binding; using Microsoft.Practices.Unity; using System; namespace Mediator.Net.Unity { public class UnityExtensioins { public static void Configure(MediatorBuilder builder, IUnityContainer container) { UnityContainerExtensions.RegisterInstance(container, typeof(MediatorBuilder), (object)builder); UnityContainerExtensions.RegisterType<IMediator, Mediator>(container, (InjectionMember[])new InjectionMember[1] { new InjectionFactory((Func<IUnityContainer, object>)delegate { IDependancyScope val = new UnityDependancyScope(container).BeginScope(); return (object)builder.Build(val); }) }); foreach (MessageBinding messageBinding in MessageHandlerRegistry.get_MessageBindings()) { UnityContainerExtensions.RegisterType(container, messageBinding.get_HandlerType(), messageBinding.get_HandlerType(), (InjectionMember[])new InjectionMember[0]); } } } }