Пример #1
0
        private static DbDeploymentManager InitializeDbMigrationManager(Arguments arguments)
        {
            var configMapper = new ConfigurationArgumentMapper(
                (string.IsNullOrEmpty(arguments.DeploymentConfigurationFilePath)
                                        ? (IDeploymentConfigurationStore) new DeploymentConfigurationInMemoryStore(
                     new DeploymentConfiguration
            {
                MigrationConfigurationInfo = new MigrationConfigurationInfo
                {
                    Type = arguments.MigrationsConfigurationType
                },

                InitializerConfigurationInfo = new InitializerConfigurationInfo
                {
                    Type = arguments.InitializerType,
                    DisableForcedSeeding = arguments.DisabledForcedSeeding,
                    ServiceAccount = string.IsNullOrEmpty(arguments.InitializerServiceAccountName)
                                                                        ? null
                                    : new ServiceAccountInfo()
                    {
                        Name = arguments.InitializerServiceAccountName,
                        AccountType = arguments.InitializerServiceAccountType,
                        Domain = arguments.InitializerServiceAccountDomainName,
                        DatabaseUser = arguments.InitializerServiceAccountDatabaseUser,
                        DatabaseUserPassword = arguments.InitializerServiceAccountDatabaseUserPassword
                    }
                }
            })
                                        : new DeploymentConfigurationXmlStore(EnsureAbsolutePath(arguments.DeploymentConfigurationFilePath))));

            var config = configMapper.FromArguments(arguments);

            config.TargetAssemblyPath           = EnsureAbsolutePath(config.TargetAssemblyPath);
            config.DeployedAssemblyOverridePath = EnsureAbsolutePath(config.DeployedAssemblyOverridePath);

            return(new DbDeploymentManager(config,
                                           new AssemblyLoader(),
                                           new SqlClientDbConnectionInfoBuilder()));
        }
Пример #2
0
		private static DbDeploymentManager InitializeDbMigrationManager(Arguments arguments)
		{
			var configMapper = new ConfigurationArgumentMapper(
				(string.IsNullOrEmpty(arguments.DeploymentConfigurationFilePath)
					? (IDeploymentConfigurationStore) new DeploymentConfigurationInMemoryStore(
						new DeploymentConfiguration
						{
							MigrationConfigurationInfo = new MigrationConfigurationInfo
							{
								Type = arguments.MigrationsConfigurationType
							},

							InitializerConfigurationInfo=new InitializerConfigurationInfo
							{
								Type = arguments.InitializerType,
								DisableForcedSeeding = arguments.DisabledForcedSeeding,
								ServiceAccount = string.IsNullOrEmpty(arguments.InitializerServiceAccountName)
									? null 
                                    : new ServiceAccountInfo()
									{
										Name = arguments.InitializerServiceAccountName,
										AccountType = arguments.InitializerServiceAccountType,
										Domain = arguments.InitializerServiceAccountDomainName,
										DatabaseUser = arguments.InitializerServiceAccountDatabaseUser,
										DatabaseUserPassword = arguments.InitializerServiceAccountDatabaseUserPassword
									}
							}
						})
					: new DeploymentConfigurationXmlStore(EnsureAbsolutePath(arguments.DeploymentConfigurationFilePath))));

			var config = configMapper.FromArguments(arguments);

			config.TargetAssemblyPath=EnsureAbsolutePath(config.TargetAssemblyPath);
			config.DeployedAssemblyOverridePath=EnsureAbsolutePath(config.DeployedAssemblyOverridePath);

			return new DbDeploymentManager(config,
				new AssemblyLoader(),
				new SqlClientDbConnectionInfoBuilder());
		}