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); }
private static void LoadContainer() { lock (Triowing) { if(IocFactory!=null) return; IocFactory = new StardustIocFactory(); } }
internal static void LoadContainer(IContainerSetup containerSetup) { lock (Triowing) { if(IocFactory!=null) throw new InvalidOperationException("Container factory already created"); IocFactory = containerSetup; } }
internal static void LoadContainer(IBlueprint config) { // ReSharper disable once SuspiciousTypeConversion.Global lock (Triowing) { if (IocFactory != null) return; IocFactory = config as IContainerSetup ?? new StardustIocFactory(); } }
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>(); }
private static void LoadContainer() { lock (Triowing) { if (IocFactory != null) { return; } IocFactory = new StardustIocFactory(); } }
internal static void LoadContainer(IContainerSetup containerSetup) { lock (Triowing) { if (IocFactory != null) { throw new InvalidOperationException("Container factory already created"); } IocFactory = containerSetup; } }
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); }
internal static void LoadContainer(IBlueprint config) { // ReSharper disable once SuspiciousTypeConversion.Global lock (Triowing) { if (IocFactory != null) { return; } IocFactory = config as IContainerSetup ?? new StardustIocFactory(); } }
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); }
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>(); }
public static void LoadIocContainer(IContainerSetup containerSetup) { HasExternalIoc = true; KernelFactory.LoadContainer(containerSetup); }
public void Setup(IContainerSetup setup) { }
public void Setup(IContainerSetup setup) { setup.For <IShipmentProvider>().Use <ZasilkovnaClient>(); }
public void Setup(IContainerSetup setup) { setup.For <IParametersResolver>().Use <ParametersResolver>(); setup.For <AutoProceduresJob>().Use <AutoProceduresJob>(); }
public void Setup(IContainerSetup setup) { setup.For <EventModelProcessor>().Use <EventModelProcessor>(); }
public void Setup(Type markedType, IContainerSetup setup) { setup.For(markedType).ImportObject.FromFactory(locator => ConfigFactory(locator, markedType)); }
public void Setup(IContainerSetup setup) { setup.For <ElsaExcelModelFactory>().Use <ElsaExcelModelFactory>(); }
public void Setup(IContainerSetup setup) { setup.For <IInvoiceFormGeneratorFactory>().Use <InvoiceFormGeneratorFactory>(); setup.For <IInvoiceFormsGenerationRunner>().Use <InvoiceFormsGenerationRunner>(); }
public void Setup(IContainerSetup setup) { setup.For <FloxDataMapper>().Use <FloxDataMapper>(); }
public void Setup(IContainerSetup setup) { setup.For <IInvoiceFormsRepository>().Use <InvoiceFormRepository>(); }
public void Setup(IContainerSetup setup) { setup.For <IUserRepository>().Use <UserRepository>(); setup.For <IUserRoleRepository>().Use <UserRepository>(); setup.For <IUserManagementFacade>().Use <UserManagementFacade>(); }
public void Setup(IContainerSetup setup) { setup.For <IProductionService>().Use <Service.ProductionService>(); setup.For <IRecipeService>().Use <RecipeService>(); }
public void Setup(IContainerSetup setup) { setup.For <InvoiceFormsQueryingFacade>().Use <InvoiceFormsQueryingFacade>(); setup.For <IInvoiceFormRendererFactory>().Use <InvoiceFormRendererFactory>(); }
public void Setup(IContainerSetup setup) { setup.For <IPaymentSystemClientFactory>().Use <PaymentSystemClientFactory>(); }
public void Setup(IContainerSetup setup) { setup.For <IStockReportLoader>().Use <StockReportLoader>(); }
public void Setup(Type markedType, IContainerSetup setup) { UserRights.RegisterType(markedType); }
public void Setup(IContainerSetup setup) { setup.For <IMailSender>().Use <SmtpMailSender>(); setup.For <IRecipientListsRepository>().Use <RecipientListsRepository>(); }
public void Setup(IContainerSetup setup) { //setup.ScanAssembly(typeof(ProfileController).Assembly); }
protected virtual void RegisterControllerNameExtractor(IContainerSetup setup) { setup.For <IControllerNameExtractor>().Use <DefaultControllerNameExtractor>(); }
public void Setup(IContainerSetup setup) { setup.For <ElerpClient>().Use <ElerpClient>(); }
public void Setup(IContainerSetup setup) { setup.For <IInspectionsRepository>().Use <InspectionsRepository>(); }
public void Setup(Type markedType, IContainerSetup setup) { setup.For(markedType).Use(m_implementingType); }