示例#1
0
        public void CanCreateSchema()
        {
            var mapper        = new AutoMapper();
            var map           = mapper.GetMap(typeof(SomeClass));
            var properties    = map.Properties;
            var keyProperties = properties.Where(p => p.IsKey);

            var creator = new SchemaManager(new SqlConnectionFactory(ConnectionString), "testtable", "testdata", "testproc", keyProperties, properties, schema: "bimse");

            creator.DropSchema(true, true, true);
            creator.CreateSchema(true, true, true);
        }
示例#2
0
        public void CanCreateSchema()
        {
            using var connection = new SqlConnection(ConnectionString);
            connection.Open();
            using var command   = connection.CreateCommand();
            command.CommandText = @"
if not exists (select top 1 * from [sys].[schemas] where [name] = 'bimse')
	exec('create schema bimse');
";
            command.ExecuteNonQuery();

            var mapper        = new AutoMapper();
            var map           = mapper.GetMap(typeof(SomeClass));
            var properties    = map.Properties;
            var keyProperties = properties.Where(p => p.IsKey);

            var creator = new SchemaManager(new SqlConnectionFactory(ConnectionString), "testtable", "testdata", "testproc", keyProperties, properties, schema: "bimse");

            creator.DropSchema(true, true, true);
            creator.CreateSchema(true, true, true);
        }
示例#3
0
 /// <summary>
 /// Immediately executes DROP statements for the things you select by setting <paramref name="dropProcedure"/>,
 /// <paramref name="dropType"/>, and/or <paramref name="dropTable"/> to <code>true</code>.
 /// </summary>
 public void DropSchema(bool dropProcedure = false, bool dropType = false, bool dropTable = false)
 {
     _schemaManager.DropSchema(dropProcedure, dropType, dropTable);
 }