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


C# IDbConnection.DropTable方法代码示例

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


在下文中一共展示了IDbConnection.DropTable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Setup

        public static void Setup(IDbConnection db)
        {
            var drop = false;

            //drop = true;

            if (drop)
            {
                //string databaseName = db.Database;
                //db.ChangeDatabase("postgres");
                //db.ExecuteSql(String.Format("DROP DATABASE {0}", databaseName));
                //db.ExecuteSql(String.Format("CREATE DATABASE {0}", databaseName));
                //db.ChangeDatabase(databaseName);

                db.DropTable<CategoryToTransaction>();

                db.DropTable<BudgetToTransaction>();
                db.DropTable<BudgetToCategory>();

                db.DropTable<UserToTransaction>();
                db.DropTable<UserToBudget>();

                db.DropTable<Transaction>();
                db.DropTable<Bill>();
                db.DropTable<Category>();
                db.DropTable<Budget>();
                db.DropTable<User>();

                db.CreateTables
                (
                     true,
                     typeof(User),
                     typeof(Budget),
                     typeof(Category),
                     typeof(Bill),
                     typeof(Transaction),

                     typeof(UserToBudget),
                     typeof(UserToTransaction),

                     typeof(BudgetToCategory),
                     typeof(BudgetToTransaction),

                     typeof(CategoryToTransaction)
                );
            }
        }
开发者ID:josiahpeters,项目名称:SimpleBudget,代码行数:47,代码来源:DbSetup.cs

示例3: TestFixtureSetUp

 public void TestFixtureSetUp()
 {
     db = base.OpenDbConnection();
     db.DropTable<OrderDetail>();
     db.DropAndCreateTable<Order>();
     db.DropAndCreateTable<Customer>();
     db.DropAndCreateTable<CustomerAddress>();
 }
开发者ID:JohnKlippenstein-AI,项目名称:ServiceStack.OrmLite,代码行数:8,代码来源:LoadReferencesTests.cs

示例4: 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

示例5: DropTables

 private void DropTables(IDbConnection dbConnection)
 {
     if (dbConnection.TableExists("TWODUC")) dbConnection.DropTable<TypeWithOnDeleteAndUpdateCascade>();
     if (dbConnection.TableExists("TWODSN")) dbConnection.DropTable<TypeWithOnDeleteSetNull>();
     if (dbConnection.TableExists("TWODDF")) dbConnection.DropTable<TypeWithOnDeleteSetDefault>();
     if (dbConnection.TableExists("TWODNR")) dbConnection.DropTable<TypeWithOnDeleteRestrict>();
     if (dbConnection.TableExists("TWODNA")) dbConnection.DropTable<TypeWithOnDeleteNoAction>();
     if (dbConnection.TableExists("TWODC")) dbConnection.DropTable<TypeWithOnDeleteCascade>();
     if (dbConnection.TableExists("TWSKF")) dbConnection.DropTable<TypeWithSimpleForeignKey>();
     if (dbConnection.TableExists("TWONFKI")) dbConnection.DropTable<TypeWithNoForeignKeyInitially>();
 }
开发者ID:JackFong,项目名称:ServiceStack.OrmLite,代码行数:11,代码来源:ForeignKeyAttributeTests.cs

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: InitTables

        private static void InitTables(IDbConnection db)
        {
            db.DropTable<FooBarBaz>();
            db.DropTable<FooBar>();
            db.DropTable<BarJoin>();
            db.DropTable<Baz>();

            db.CreateTable<Baz>();
            db.CreateTable<BarJoin>();
            db.CreateTable<FooBar>();
            db.CreateTable<FooBarBaz>();

            var bar1Id = new Guid("5bd67b84-bfdb-4057-9799-5e7a72a6eaa9");
            var bar2Id = new Guid("a8061d08-6816-4e1e-b3d7-1178abcefa0d");

            db.Insert(new BarJoin { Id = bar1Id, Name = "Banana", });
            db.Insert(new BarJoin { Id = bar2Id, Name = "Orange", });

            _baz1Id = (int)db.Insert(new Baz { Name = "Large" }, true);
            _baz2Id = (int)db.Insert(new Baz { Name = "Huge" }, true);

            _fooBar1Id = (int)db.Insert(new FooBar { BarId = bar1Id, }, true);
            _fooBar2Id = (int)db.Insert(new FooBar { BarId = bar2Id, }, true);

            _fooBarBaz1Id = (int)db.Insert(new FooBarBaz { Amount = 42, FooBarId = _fooBar1Id, BazId = _baz2Id }, true);
            _fooBarBaz2Id = (int)db.Insert(new FooBarBaz { Amount = 50, FooBarId = _fooBar1Id, BazId = _baz1Id }, true);
            _fooBarBaz3Id = (int)db.Insert(new FooBarBaz { Amount = 2, FooBarId = _fooBar2Id, BazId = _baz1Id }, true);
        }
开发者ID:wrx362114,项目名称:ServiceStack.OrmLite,代码行数:28,代码来源:ComplexJoinTests.cs

示例11: CreateNorthwindTables

		public static void CreateNorthwindTables(IDbConnection db)
		{
			db.DropTable<EmployeeTerritory>();
			db.DropTable<Territory>();
			db.DropTable<Region>();
			db.DropTable<CustomerDemographic>();
			db.DropTable<CustomerCustomerDemo>();
			db.DropTable<OrderDetail>();
			db.DropTable<Product>();
			db.DropTable<Order>();
			db.DropTable<Supplier>();
			db.DropTable<Shipper>();
			db.DropTable<Customer>();
			db.DropTable<Category>();
			db.DropTable<Employee>();


			db.CreateTables
				(
					true,
					typeof (Employee),
					typeof (Category),
					typeof (Customer),
					typeof (Shipper),
					typeof (Supplier),
					typeof (Order),
					typeof (Product),
					typeof (OrderDetail),
					typeof (CustomerCustomerDemo),
					typeof (CustomerDemographic),
					typeof (Region),
					typeof (Territory),
					typeof (EmployeeTerritory)
				);
		}
开发者ID:ciker,项目名称:simplestack.ormlite,代码行数:35,代码来源:OrmLiteNorthwindTests.cs

示例12: DropTables

 public static void DropTables(IDbConnection db)
 {
     db.DropTable<OrderDetail>();
     db.DropTable<Order>();
     db.DropTable<Customer>();
     db.DropTable<Product>();
     db.DropTable<Employee>();
 }
开发者ID:JackFong,项目名称:ServiceStack.OrmLite,代码行数:8,代码来源:CustomerOrdersUseCase.cs

示例13: TestFixtureSetUp

 public new void TestFixtureSetUp()
 {
     db = base.OpenDbConnection();
     db.DropTable<OrderDetail>();
     db.DropAndCreateTable<Order>();
     db.DropAndCreateTable<Customer>();
     db.DropAndCreateTable<CustomerAddress>();
     db.DropAndCreateTable<AliasedCustomer>();
     db.DropAndCreateTable<AliasedCustomerAddress>();
     db.DropAndCreateTable<OldAliasedCustomer>();
     db.DropAndCreateTable<OldAliasedCustomerAddress>();
     db.DropAndCreateTable<MismatchAliasCustomer>();
     db.DropAndCreateTable<MismatchAliasAddress>();
 }
开发者ID:hdczsf,项目名称:ServiceStack.OrmLite,代码行数:14,代码来源:LoadReferencesTests.cs


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