Ejemplo n.º 1
0
        public void Setup(IContainerSetup setup)
        {
            //AsyncLogger.Initialize(new ConnectionStringProvider());

            setup.For <IConfigurationRepository>().Use <ConfigurationRepository>();
            setup.For <ILog>().Use <Logger>();
            setup.For <ICache>().Use <Cache>();
            setup.For <IPerProjectDbCache>().Use <PerProjectDbCache>();
            setup.For <ISysCountersManager>().Use <SysCounterManager>();
        }
Ejemplo n.º 2
0
        public void Setup(Type markedType, IContainerSetup setup)
        {
            if (!setup.GetRegisteredPlugins <ControllerCollectorPlugin>().Any())
            {
                setup.RegisterPlugin(s => s.CustomInstanceCreators.Add(new ControllerCollectorPlugin()));
            }

            setup.For(markedType)
            .Use(markedType)
            .WithBehavior <ControllerBehavior>(SetupBehavior);
        }
Ejemplo n.º 3
0
        public void Setup(Type markedType, IContainerSetup setup)
        {
            if (!setup.GetRegisteredPlugins <EntityPlugin>().Any())
            {
                setup.RegisterPlugin(p => p.CustomInstanceCreators.Add(new EntityPlugin(new DefaultRobOrmSetup())));
            }

            if (!setup.GetRegisteredPlugins <EntityCollectorPlugin>().Any())
            {
                setup.RegisterPlugin(p => p.CustomInstanceCreators.Add(new EntityCollectorPlugin()));
                setup.For <IEntityCollector>();
            }

            var entityName = EntityName;

            if (string.IsNullOrWhiteSpace(entityName))
            {
                entityName = NamingHelper.GetDefaultEntityName(markedType);
            }

            var pkProperty = PrimaryKeyProperty;

            if (string.IsNullOrWhiteSpace(pkProperty))
            {
                pkProperty = "Id";
            }

            if (ReflectionUtil.GetProperty(markedType, pkProperty) == null)
            {
                throw new InvalidOperationException($"{markedType.Name} - Primary Key property \"{pkProperty}\" not found");
            }

            setup.For(markedType)
            .WithBehavior <EntityBehavior>(db =>
            {
                db.EntityName         = entityName;
                db.PrimaryKeyProperty = pkProperty;
            })
            .WithBehavior <LifecycleBehavior>(lb => lb.AlwaysNewInstance = true)
            .WithBehavior <DisposeBehavior>(db => db.Dispose             = false);
        }
Ejemplo n.º 4
0
        public static Action <IContainer, MigrationCustomizer> InitializeAndGetMigrator(
            IContainerSetup s,
            Func <ISqlConnectionStringProvider> connectionStringProviderFactory,
            params Assembly[] entitiesOrigin)
        {
            s.For <ISqlConnectionStringProvider>().Import.FromFactory(locator => connectionStringProviderFactory());

            s.For <IDataModelHelper>().Use <CachedDataModelHelper>();
            s.For <ITransactionManager <SqlConnection> >().Use <ConnectionCreator>();
            s.For <IDatabase>().Use <Database>();
            s.For <ISchemaMigrator>().Use <SchemaMigrator>();
            s.For <IEntityNamingConvention>().Use <DefaultEntityNamingConvention>();

            foreach (var assembly in entitiesOrigin)
            {
                s.ScanAssembly(assembly);
            }

            Action <IContainer, MigrationCustomizer> migratorFunc = (container, customizer) =>
            {
                var sqlScriptGenerator = new SqlMigrationScriptBuilder();
                var hashBuilder        = new MigrationHashBuilder();
                var proxy = new ScriptBuilderProxy(hashBuilder, sqlScriptGenerator);

                if (customizer != null)
                {
                    proxy.AddCustomScript(customizer.BeforeMigrationScript, customizer.AfterMigrationScript);
                }

                using (var locator = container.GetLocator())
                {
                    var migrator = locator.Get <ISchemaMigrator>();
                    migrator.MigrateStructure(locator, proxy);

                    var hash   = hashBuilder.GetHash();
                    var script = sqlScriptGenerator.ToString(hash);

                    var connectionBuilder = locator.Get <ITransactionManager <SqlConnection> >();

                    using (var connection = connectionBuilder.Open(false))
                    {
                        using (var command = new SqlCommand(script, connection.GetConnection()))
                        {
                            command.CommandTimeout = 1000000;
                            command.ExecuteNonQuery();
                        }

                        connection.Commit();
                    }

                    if (!string.IsNullOrWhiteSpace(customizer.ScriptsRoot))
                    {
                        ScriptsMigrator.RunScripts(connectionBuilder, customizer.ScriptsRoot);
                    }
                }
            };

            return(migratorFunc);
        }
Ejemplo n.º 5
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IUserRepository>().Use <UserRepository>();
     setup.For <IUserRoleRepository>().Use <UserRepository>();
     setup.For <IUserManagementFacade>().Use <UserManagementFacade>();
 }
Ejemplo n.º 6
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IInvoiceFormsRepository>().Use <InvoiceFormRepository>();
 }
Ejemplo n.º 7
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <InvoiceFormsQueryingFacade>().Use <InvoiceFormsQueryingFacade>();
     setup.For <IInvoiceFormRendererFactory>().Use <InvoiceFormRendererFactory>();
 }
Ejemplo n.º 8
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IProductionService>().Use <Service.ProductionService>();
     setup.For <IRecipeService>().Use <RecipeService>();
 }
Ejemplo n.º 9
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IStockReportLoader>().Use <StockReportLoader>();
 }
Ejemplo n.º 10
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <FloxDataMapper>().Use <FloxDataMapper>();
 }
Ejemplo n.º 11
0
 public void Setup(Type markedType, IContainerSetup setup)
 {
     setup.For(markedType).Use(m_implementingType);
 }
Ejemplo n.º 12
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IShipmentProvider>().Use <ZasilkovnaClient>();
 }
Ejemplo n.º 13
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IInspectionsRepository>().Use <InspectionsRepository>();
 }
Ejemplo n.º 14
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <ElerpClient>().Use <ElerpClient>();
 }
Ejemplo n.º 15
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IMailSender>().Use <SmtpMailSender>();
     setup.For <IRecipientListsRepository>().Use <RecipientListsRepository>();
 }
Ejemplo n.º 16
0
 public void Setup(Type markedType, IContainerSetup setup)
 {
     setup.For(markedType).ImportObject.FromFactory(locator => ConfigFactory(locator, markedType));
 }
Ejemplo n.º 17
0
 protected virtual void RegisterControllerNameExtractor(IContainerSetup setup)
 {
     setup.For <IControllerNameExtractor>().Use <DefaultControllerNameExtractor>();
 }
Ejemplo n.º 18
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IGeocodingProvider>().Use <OpenStreetMapClient>();
 }
Ejemplo n.º 19
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <EventModelProcessor>().Use <EventModelProcessor>();
 }
Ejemplo n.º 20
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IInvoiceFormGeneratorFactory>().Use <InvoiceFormGeneratorFactory>();
     setup.For <IInvoiceFormsGenerationRunner>().Use <InvoiceFormsGenerationRunner>();
 }
Ejemplo n.º 21
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <InvoiceModelFactory>().Use <InvoiceModelFactory>();
     setup.For <IInvoiceFileProcessor>().Use <InvoiceModelProcessor>();
 }
Ejemplo n.º 22
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IPaymentSystemClientFactory>().Use <PaymentSystemClientFactory>();
 }
Ejemplo n.º 23
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IParametersResolver>().Use <ParametersResolver>();
     setup.For <AutoProceduresJob>().Use <AutoProceduresJob>();
 }
Ejemplo n.º 24
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <ElsaExcelModelFactory>().Use <ElsaExcelModelFactory>();
 }
Ejemplo n.º 25
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IScheduledJobsRepository>().Use <ScheduledJobsRepository>();
     setup.For <IJobExecutor>().Use <JobLauncher>();
 }
Ejemplo n.º 26
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IErpClientFactory>().Use <ErpClientFactory>();
     setup.For <IPurchaseOrderRepository>().Use <PurchaseOrderRepository>();
     setup.For <ICurrencyRepository>().Use <CurrencyRepository>();
     setup.For <IProductRepository>().Use <ProductRepository>();
     setup.For <IOrderStatusMappingRepository>().Use <OrderStatusMappingRepository>();
     setup.For <IOrderStatusTranslator>().Use <OrderStatusTranslator>();
     setup.For <IOrderStatusRepository>().Use <OrderStatusRepository>();
     setup.For <IPaymentRepository>().Use <PaymentRepository>();
     setup.For <IOrdersFacade>().Use <OrdersFacade>();
     setup.For <IVirtualProductRepository>().Use <VirtualProductRepository>();
     setup.For <IErpRepository>().Use <ErpRepository>();
     setup.For <IUnitRepository>().Use <UnitRepository>();
     setup.For <IUnitConversionHelper>().Use <UnitConversionHelper>();
     setup.For <IMaterialRepository>().Use <MaterialRepository>();
     setup.For <IVirtualProductFacade>().Use <VirtualProductFacade>();
     setup.For <IMaterialFacade>().Use <MaterialFacade>();
     setup.For <IKitProductRepository>().Use <KitProductRepository>();
     setup.For <ICustomerRepository>().Use <CustomerRepository>();
     setup.For <IUserRepository>().Use <UserRepository>();
     setup.For <IMaterialBatchRepository>().Use <MaterialBatchRepository>();
     setup.For <IMaterialBatchFacade>().Use <MaterialBatchFacade>();
     setup.For <AmountProcessor>().Use <AmountProcessor>();
     setup.For <IPackingPreferredBatchRepository>().Use <PreferredBatchRepository>();
     setup.For <IProductionFacade>().Use <ProductionFacade>();
     setup.For <IBatchReportingFacade>().Use <BatchReportingFacade>();
     setup.For <IMaterialThresholdRepository>().Use <MaterialThresholdRepository>();
     setup.For <IStockEventRepository>().Use <StockEventRepository>();
     setup.For <ISupplierRepository>().Use <SupplierRepository>();
     setup.For <ICurrencyConversionHelper>().Use <CurrencyConversionHelper>();
     setup.For <IRepositoryFactory>().Use <RepositoryFactory>();
     setup.For <IFixedCostRepository>().Use <FixedCostRepository>();
     setup.For <ISaleEventRepository>().Use <SaleEventRepository>();
     setup.For <IRecipeRepository>().Use <RecipeRepository>();
     setup.For <IOrderWeightCalculator>().Use <OrderWeightCalculator>();
 }
Ejemplo n.º 27
0
 public void Setup(IContainerSetup setup)
 {
     setup.For <IMaterialLevelsLoader>().Use <MaterialLevelsLoader>();
     setup.For <IInventoryWatchRepository>().Use <InventoryWatchRepository>();
 }