Closed mdissel closed 4 years ago
How can I register required delegate ServiceFactory defined in the popular MediatR package?
public delegate object ServiceFactory(Type serviceType);
For now I'm registering the necessary types for MediatR as:
c.Export(typeof(RequestPreProcessorBehavior<,>)).As(typeof(IPipelineBehavior<,>)); c.Export(typeof(RequestPostProcessorBehavior<,>)).As(typeof(IPipelineBehavior<,>)); c.Export(typeof(RequestExceptionActionProcessorBehavior<,>)).As(typeof(IPipelineBehavior<,>)); c.Export(typeof(RequestExceptionProcessorBehavior<,>)).As(typeof(IPipelineBehavior<,>)); c.Export<Mediator>().As(typeof(IMediator)).Lifestyle.Singleton(); c.ExportAssemblies(assemblies).ByInterface(typeof(IRequestHandler<,>)); c.ExportAssemblies(assemblies).ByInterface(typeof(INotificationHandler<>)); c.ExportAssemblies(assemblies).ByInterface(typeof(IRequestPreProcessor<>)); c.ExportAssemblies(assemblies).ByInterface(typeof(IRequestPostProcessor<,>)); c.ExportAssemblies(assemblies).ByInterface(typeof(IRequestExceptionHandler<,,>)); c.ExportAssemblies(assemblies).ByInterface(typeof(IRequestExceptionAction<,>));
Thanks
Give this a whirl
c.ExportFunc<ServiceFactory>(scope => scope.Locate);
How can I register required delegate ServiceFactory defined in the popular MediatR package?
public delegate object ServiceFactory(Type serviceType);
For now I'm registering the necessary types for MediatR as:
Thanks