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


C# IDbConnection.CreateTable方法代码示例

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


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

示例1: RecreateAnyObjectTables

 private static void RecreateAnyObjectTables(IDbConnection db)
 {
     db.DropTable<AnyObjectClassItem>();
     db.DropTable<AnyObjectClass>();
     db.CreateTable<AnyObjectClass>();
     db.CreateTable<AnyObjectClassItem>();
 }
开发者ID:chrisklepeis,项目名称:ServiceStack.OrmLite,代码行数:7,代码来源:SqlExpressionSubSqlExpressionIssue.cs

示例2: DropAndCreateTables

        private void DropAndCreateTables(IDbConnection db)
        {
            if (db.TableExists("ParamRelBO"))
                db.DropTable<ParamRelBO>();

            db.CreateTable<ParamTestBO>(true);
            db.CreateTable<ParamRelBO>(true);
        }
开发者ID:babcca,项目名称:ServiceStack.OrmLite,代码行数:8,代码来源:OracleParamTests.cs

示例3: Run

        protected override void Run(IDbConnection db)
		{
			if (this.IsFirstRun)
			{
				db.CreateTable<Order>(true);
			}

			db.Insert(NorthwindFactory.Order(this.Iteration, "VINET", 5, new DateTime(1996, 7, 4), new DateTime(1996, 1, 8), new DateTime(1996, 7, 16), 3, 32.38m, "Vins et alcools Chevalier", "59 rue de l'Abbaye", "Reims", null, "51100", "France"));
		}
开发者ID:CormacBrennan-AI,项目名称:ServiceStack.OrmLite,代码行数:9,代码来源:InsertNorthwindModelScenario.cs

示例4: Run

        protected override void Run(IDbConnection db)
		{
			if (this.IsFirstRun)
			{
				db.CreateTable<SampleOrderLine>(true);
			}

			db.Insert(SampleOrderLine.Create(userId, this.Iteration, 1));
		}
开发者ID:yeurch,项目名称:ServiceStack.OrmLite,代码行数:9,代码来源:InsertSampleOrderLineScenario.cs

示例5: Run

		protected override void Run(IDbConnection db)
		{
			if (this.IsFirstRun)
			{
				db.CreateTable<ModelWithFieldsOfDifferentTypesPerf>(true);
			}

			db.Insert(ModelWithFieldsOfDifferentTypesPerf.Create(this.Iteration));
		}
开发者ID:CormacBrennan-AI,项目名称:ServiceStack.OrmLite,代码行数:9,代码来源:InsertModelWithFieldsOfDifferentTypesScenario.cs

示例6: DoInsertUpdate

        private static void DoInsertUpdate(IDbConnection db)
        {
            db.CreateTable<ParamPassword>(true);

            var row = new ParamPassword { Id = 2, Password = 6 };
            db.Insert(row);

            row.Password = 335;
            db.Update(row);
        }
开发者ID:JackFong,项目名称:ServiceStack.OrmLite,代码行数:10,代码来源:WrappedCommandTests.cs

示例7: InitTables

        private static void InitTables(IDbConnection db)
        {
            db.DropTable<FooSpace>();
            db.DropTable<BarSpace>();

            db.CreateTable<BarSpace>();
            db.CreateTable<FooSpace>();

            _bar1Id = new Guid("5bd67b84-bfdb-4057-9799-5e7a72a6eaa9");
            _bar2Id = new Guid("a8061d08-6816-4e1e-b3d7-1178abcefa0d");
            _bar3Id = new Guid("84BF769D-5BA9-4506-A7D2-5030E5595EDC");

            db.Insert(new BarSpace { Id = _bar1Id, Name = "Banana", });
            db.Insert(new BarSpace { Id = _bar2Id, Name = "Orange", });
            db.Insert(new BarSpace { Id = _bar3Id, Name = "Apple", });

            _foo1Id = (int)db.Insert(new FooSpace { BarId = _bar1Id, }, true);
            _foo2Id = (int)db.Insert(new FooSpace { BarId = _bar2Id, }, true);
            _foo3Id = (int)db.Insert(new FooSpace { BarId = _bar3Id, }, true);
        }
开发者ID:chrisklepeis,项目名称:ServiceStack.OrmLite,代码行数:20,代码来源:ComplexJoinWithLimitAndSpacesInAliasesTests.cs

示例8: Execute

 public void Execute(IDbConnection db)
 {
     if (!db.TableExists(db.GetTableName<SiteSettings>()))
     {
         db.CreateTable<SiteSettings>();
     }
     else
     {
         // Append the analytics specific columns
         db.AddColumn<SiteSettings>(x => x.AnalyticsProfileId);
         db.AddColumn<SiteSettings>(x => x.AnalyticsToken);
     }
 }
开发者ID:Relix1990,项目名称:MvcKickstart,代码行数:13,代码来源:InitKickstartAnalytics.cs

示例9: PopulateData

        private static Sale PopulateData(IDbConnection db, Guid tenantId)
        {
            db.DropTable<Sale>();
            db.DropTable<ContactIssue>();

            db.CreateTable<ContactIssue>();
            db.CreateTable<Sale>();

            var buyer = new ContactIssue
            {
                Id = Guid.NewGuid(),
                TenantId = tenantId,
                FirstName = "BuyerFirst",
                LastName = "LastBuyer"
            };

            var seller = new ContactIssue
            {
                Id = Guid.NewGuid(),
                TenantId = tenantId,
                FirstName = "SellerFirst",
                LastName = "LastSeller"
            };

            db.Insert(buyer, seller);

            var sale = new Sale
            {
                Id = Guid.NewGuid(),
                TenantId = tenantId,
                BuyerId = buyer.Id,
                SellerId = seller.Id,
                AmountCents = 100,
            };

            db.Insert(sale);
            return sale;
        }
开发者ID:ServiceStack,项目名称:ServiceStack.OrmLite,代码行数:38,代码来源:MultipleSelfJoinsWithAliases.cs

示例10: FillAliasedTestEntityTableWithTestData

        /// <summary>Fill aliased test entity table with test data.</summary>
        /// <param name="db">The database.</param>
        protected void FillAliasedTestEntityTableWithTestData(IDbConnection db)
        {
            db.CreateTable<TestEntityWithAliases>(true);

            for (int i = 1; i < 1000; i++)
            {
                db.Insert(new TestEntityWithAliases()
                {
                    Foo = RandomString(16),
                    Bar = RandomString(16),
                    Baz = RandomDecimal(i)
                });
            }
        }
开发者ID:sami1971,项目名称:NServiceKit.OrmLite,代码行数:16,代码来源:SqlServerExpressionVisitorQueryTest.cs

示例11: TestFixtureSetUp

        public new void TestFixtureSetUp()
        {
            db = base.OpenDbConnection();
            CustomerOrdersUseCase.DropTables(db); //Has conflicting 'Order' table

            db.DropAndCreateTable<Order>();
            db.DropAndCreateTable<Customer>();
            db.DropAndCreateTable<CustomerAddress>();
            db.DropAndCreateTable<Country>();
            db.DropAndCreateTable<AliasedCustomer>();
            db.DropAndCreateTable<AliasedCustomerAddress>();
            db.DropAndCreateTable<OldAliasedCustomer>();
            db.DropAndCreateTable<OldAliasedCustomerAddress>();
            db.DropAndCreateTable<MismatchAliasCustomer>();
            db.DropAndCreateTable<MismatchAliasAddress>();

            db.DropTable<SelfCustomer>();
            db.DropTable<MultiSelfCustomer>();
            db.DropTable<SelfCustomerAddress>();

            db.CreateTable<SelfCustomerAddress>();
            db.CreateTable<MultiSelfCustomer>();
            db.CreateTable<SelfCustomer>();
        }
开发者ID:wrx362114,项目名称:ServiceStack.OrmLite,代码行数:24,代码来源:LoadReferencesTests.cs

示例12: initDatabase

 public override void initDatabase(IDbConnection db)
 {
     db.CreateTable<ChannelEntry> ();
 }
开发者ID:ttwj,项目名称:dreamskape,代码行数:4,代码来源:ChanServ.cs

示例13: SetUp

 public void SetUp()
 {
     CreateNewDatabase();
     db = ConnectionString.OpenDbConnection();
     db.CreateTable<ModelWithFieldsOfDifferentTypes>(true);
 }
开发者ID:JduPreez,项目名称:ServiceStack.OrmLite,代码行数:6,代码来源:OrmLiteDeleteTests.cs

示例14: DropAndCreateTables

        private void DropAndCreateTables(IDbConnection db)
        {
            if (db.TableExists("ParamRelBO"))
                db.DropTable<ParamRelBo>();

            db.CreateTable<ParamTestBo>(true);
            db.CreateTable<ParamRelBo>(true);
            db.CreateTable<ParamByteBo>(true);
            db.CreateTable<ParamComment>(true);
            db.CreateTable<ParamOrder>(true);
            db.CreateTable<ParamLeft>(true);
            db.CreateTable<ParamUser>(true);
            db.CreateTable<ParamPassword>(true);
            db.CreateTable<ParamActive>(true);
            db.CreateTable<ParamDouble>(true);
            db.CreateTable<ParamFloat>(true);
            db.CreateTable<ParamDecimal>(true);
            db.CreateTable<ParamString>(true);
            db.CreateTable<ParamDate>(true);
            db.CreateTable<ParamDateTime>(true);
            db.CreateTable<ParamType>(true);
            db.CreateTable<ParamTimestamp>(true);
        }
开发者ID:JackFong,项目名称:ServiceStack.OrmLite,代码行数:23,代码来源:OracleParamTests.cs

示例15: RecreateTables

        public static void RecreateTables(IDbConnection db)
        {
            DropTables(db);

            db.CreateTable<Employee>();
            db.CreateTable<Product>();
            db.CreateTable<Customer>();
            db.CreateTable<Order>();
            db.CreateTable<OrderDetail>();
        }
开发者ID:JackFong,项目名称:ServiceStack.OrmLite,代码行数:10,代码来源:CustomerOrdersUseCase.cs


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