Esempio n. 1
0
        private static void RegisterExports(IExportRegistrationBlock block)
        {
            block.ExportAs <SerializationTypeCreator, ISerializationTypeCreator>().Lifestyle.Singleton()
            .IfNotRegistered(typeof(ISerializationTypeCreator));

            block.ExportAs <ServiceImplementationGenerator, IServiceImplementationGenerator>().Lifestyle.Singleton()
            .IfNotRegistered(typeof(IServiceImplementationGenerator));

            block.ExportAs <RpcExecutionService, IRpcExecutionService>().Lifestyle.Singleton()
            .IfNotRegistered(typeof(IRpcExecutionService));
        }
Esempio n. 2
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>();
        }