Esempio n. 1
0
        public void Configure(IExportRegistrationBlock registrationBlock)
        {
            var assembly = System.Reflection.Assembly.Load("BusinessSolutions.Common.Infra");

            registrationBlock.ExportAssembly(assembly)
            .ByInterfaces();

            assembly = System.Reflection.Assembly.Load("CommonSettings.DAL");
            registrationBlock.ExportAssembly(assembly)
            .ExportAttributedTypes();

            assembly = System.Reflection.Assembly.Load("CommonSettings.BLL");
            registrationBlock.ExportAssembly(assembly)
            .ExportAttributedTypes();

            assembly = System.Reflection.Assembly.Load("Sanabel.Security.Infra");
            registrationBlock.ExportAssembly(assembly).ByInterfaces(c => c.Name.EndsWith("Repository") ||
                                                                    c.Name.EndsWith("UnitOfWork"));

            assembly = System.Reflection.Assembly.Load("Security.AspIdentity");
            registrationBlock.ExportAssembly(assembly)
            .ByInterfaces();

            assembly = System.Reflection.Assembly.Load("Sanabel.Security.Application");
            registrationBlock.ExportAssembly(assembly)
            .ByInterfaces();

            assembly = System.Reflection.Assembly.Load("Sanable.Cases.Infra");
            registrationBlock.ExportAssembly(assembly)
            .ByInterfaces();

            assembly = System.Reflection.Assembly.Load("Sanabel.Cases.App");
            registrationBlock.ExportAssembly(assembly)
            .ByInterfaces();

            assembly = System.Reflection.Assembly.Load("Sanabel.Volunteers.Infra");
            registrationBlock.ExportAssembly(assembly)
            .ByInterfaces();

            assembly = System.Reflection.Assembly.Load("Sanabel.Volunteers.Application");
            registrationBlock.ExportAssembly(assembly)
            .ByInterfaces();


            registrationBlock.ExportFactory <IAuthenticationManager>(() => HttpContext.Current.GetOwinContext().Authentication);

            var logger = NLog.LogManager.CreateNullLogger();

            registrationBlock.ExportInstance(logger).As <NLog.ILogger>()
            .Lifestyle.Singleton();

            registrationBlock.ExportAs <AppLogger, ILogger>();

            registrationBlock.ExportAssemblyContaining <CompositionRoot>()
            .BasedOn <Controller>();

            registrationBlock.ExportAssemblyContaining <CompositionRoot>()
            .BasedOn <ApiController>();
        }
Esempio n. 2
0
        public void Configure(IExportRegistrationBlock builder)
        {
            builder.Export <Mediator>()
            .As <IMediator>()
            .Lifestyle.Singleton();

            var mediatrOpenTypes = new[]
            {
                typeof(IRequestHandler <,>),
                typeof(IRequestPostProcessor <,>)
            };

            foreach (var mediatrOpenType in mediatrOpenTypes)
            {
                builder.ExportAssemblyContaining <GithubAuthentication>()
                .ByInterface(mediatrOpenType);
            }

            builder.ExportInstance <ServiceFactory>((scope, context) => scope.Locate);
        }