当前位置: 首页>>代码示例>>C#>>正文


C# Schema.AddTable方法代码示例

本文整理汇总了C#中Schema.AddTable方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.AddTable方法的具体用法?C# Schema.AddTable怎么用?C# Schema.AddTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schema的用法示例。


在下文中一共展示了Schema.AddTable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddTable

        public void AddTable()
        {
            Schema schema = new Schema();
            TableDefinition table = new TableDefinition("Foo");

            schema.AddTable(table);

            Assert.AreSame(table, schema.Tables[0]);
        }
开发者ID:hoonsbara,项目名称:octalforty-wizardby,代码行数:9,代码来源:SchemaTestFixture.cs

示例2: GetTable

        public void GetTable()
        {
            Schema schema = new Schema();
            schema.AddSchema(new SchemaDefinition("dbo"));

            schema.AddTable(new TableDefinition("Foo", schema.Schemas[0]));
            schema.AddTable(new TableDefinition("baR"));

            Assert.IsNull(schema.GetTable("Foo"));

            Assert.AreSame(schema.Tables[0], schema.GetTable("dbo", "Foo"));
            Assert.AreSame(schema.Tables[0], schema.GetTable("DBO", "FOO"));
            Assert.AreSame(schema.Tables[0], schema.GetTable(schema.Schemas[0], "FOO"));

            Assert.AreSame(schema.Tables[1], schema.GetTable("BaR"));
            Assert.AreSame(schema.Tables[1], schema.GetTable("baR"));

            Assert.IsNull(schema.GetTable("Qux"));
        }
开发者ID:hoonsbara,项目名称:octalforty-wizardby,代码行数:19,代码来源:SchemaTestFixture.cs

示例3: SchemePreservesOrder

        public void SchemePreservesOrder()
        {
            char[] names = "ZYWRFAB1QTD{}".ToCharArray();

            Schema schema = new Schema();
            foreach(char name in names)
                schema.AddTable(new TableDefinition(name.ToString()));

            for (int i = 0; i < schema.Tables.Count; ++i)
            {
                Assert.AreEqual(names[i].ToString(), schema.Tables[i].Name);
            }
        }
开发者ID:hoonsbara,项目名称:octalforty-wizardby,代码行数:13,代码来源:SchemaTestFixture.cs

示例4: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            schema = new Schema();

            TableDefinition barTable = new TableDefinition("Bar");
            barTable.AddColumn(new ColumnDefinition("ID", "Bar", DbType.Int32, false, null, null, null, true, false));
            barTable.AddColumn(new ColumnDefinition("Name", DbType.String, false, 1000, null, null));
            barTable.AddColumn(new ColumnDefinition("ParentID", DbType.Int32, true, null, null, null));

            uqNameIndex = new IndexDefinition("UQ_Name", new IndexColumnDefinition("Name", SortDirection.Ascending));
            uqNameIndex.Unique = true;
            uqNameIndex.Clustered = true;
            barTable.AddIndex(uqNameIndex);

            ReferenceDefinition fkBarReference = new ReferenceDefinition("FK_Bar", "Bar", "Bar");
            fkBarReference.PkColumns.Add("ID");
            fkBarReference.FkColumns.Add("ParentID");

            schema.AddTable(barTable);
        }
开发者ID:hoonsbara,项目名称:octalforty-wizardby,代码行数:20,代码来源:AstBuilderTestFixture.cs

示例5: SetupTables

 private static void SetupTables(ListMapping<IDatabase, IMapping> Mappings, IDatabase Key, Schema.Default.Database.Database TempDatabase)
 {
     Contract.Requires<NullReferenceException>(Mappings != null, "Mappings");
     foreach (IMapping Mapping in Mappings[Key])
     {
         TempDatabase.AddTable(Mapping.TableName);
         SetupProperties(TempDatabase[Mapping.TableName], Mapping);
     }
 }
开发者ID:modulexcite,项目名称:Craig-s-Utility-Library,代码行数:9,代码来源:SQLServerSchemaGenerator.cs

示例6: SetupJoiningTablesEnumerable

 private static void SetupJoiningTablesEnumerable(ListMapping<IDatabase, IMapping> Mappings, IMapping Mapping, IProperty Property, IDatabase Key, Schema.Default.Database.Database TempDatabase)
 {
     Contract.Requires<ArgumentNullException>(TempDatabase != null, "TempDatabase");
     Contract.Requires<ArgumentNullException>(TempDatabase.Tables != null, "TempDatabase.Tables");
     if (TempDatabase.Tables.FirstOrDefault(x => x.Name == Property.TableName) != null)
         return;
     IMapping MapMapping = Mappings[Key].FirstOrDefault(x => x.ObjectType == Property.Type);
     if (MapMapping == null)
         return;
     if (MapMapping == Mapping)
     {
         TempDatabase.AddTable(Property.TableName);
         TempDatabase[Property.TableName].AddColumn("ID_", DbType.Int32, 0, false, true, true, true, false, "", "", "");
         TempDatabase[Property.TableName].AddColumn(Mapping.TableName + Mapping.IDProperties.First().FieldName,
             Mapping.IDProperties.First().Type.To(DbType.Int32),
             Mapping.IDProperties.First().MaxLength,
             false,
             false,
             false,
             false,
             false,
             Mapping.TableName,
             Mapping.IDProperties.First().FieldName,
             "",
             false,
             false,
             false);
         TempDatabase[Property.TableName].AddColumn(MapMapping.TableName + MapMapping.IDProperties.First().FieldName + "2",
             MapMapping.IDProperties.First().Type.To(DbType.Int32),
             MapMapping.IDProperties.First().MaxLength,
             false,
             false,
             false,
             false,
             false,
             MapMapping.TableName,
             MapMapping.IDProperties.First().FieldName,
             "",
             false,
             false,
             false);
     }
     else
     {
         TempDatabase.AddTable(Property.TableName);
         TempDatabase[Property.TableName].AddColumn("ID_", DbType.Int32, 0, false, true, true, true, false, "", "", "");
         TempDatabase[Property.TableName].AddColumn(Mapping.TableName + Mapping.IDProperties.First().FieldName,
             Mapping.IDProperties.First().Type.To(DbType.Int32),
             Mapping.IDProperties.First().MaxLength,
             false,
             false,
             false,
             false,
             false,
             Mapping.TableName,
             Mapping.IDProperties.First().FieldName,
             "",
             true,
             false,
             false);
         TempDatabase[Property.TableName].AddColumn(MapMapping.TableName + MapMapping.IDProperties.First().FieldName,
             MapMapping.IDProperties.First().Type.To(DbType.Int32),
             MapMapping.IDProperties.First().MaxLength,
             false,
             false,
             false,
             false,
             false,
             MapMapping.TableName,
             MapMapping.IDProperties.First().FieldName,
             "",
             true,
             false,
             false);
     }
 }
开发者ID:modulexcite,项目名称:Craig-s-Utility-Library,代码行数:76,代码来源:SQLServerSchemaGenerator.cs


注:本文中的Schema.AddTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。