• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IDatabase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IDatabase的典型用法代码示例。如果您正苦于以下问题:C# IDatabase类的具体用法?C# IDatabase怎么用?C# IDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IDatabase类属于命名空间,在下文中一共展示了IDatabase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FrmModifyUser

 public FrmModifyUser(IEngine engine, IDatabase db, OpenDMS.Storage.Security.Session session)
 {
     InitializeComponent();
     _engine = engine;
     _db = db;
     _session = session;
 }
开发者ID:274706834,项目名称:opendms-dot-net,代码行数:7,代码来源:FrmModifyUser.cs


示例2: OrderRepo

        public OrderRepo(IDatabase database)
        {
            if (database == null)
                throw new ArgumentNullException("database");

            _Database = database;
        }
开发者ID:18098924759,项目名称:sqlhelper2,代码行数:7,代码来源:OrderRepo.cs


示例3: Up

 public void Up(IDatabase db)
 {
     db.CreateTable(_tableName)
         .WithPrimaryKeyColumn(TimestampColumnName, DbType.Int64)
         .WithPrimaryKeyColumn(ModuleColumnName, DbType.String).OfSize(MigrationExportAttribute.MaximumModuleNameLength)
         .WithNullableColumn(TagColumnName, DbType.String).OfSize(2000);
 }
开发者ID:mediocreguy,项目名称:MigSharp,代码行数:7,代码来源:BootstrapMigration.cs


示例4: MetadataProvider

 public MetadataProvider(IDatabase database, IEnumerable<MetadataBase> metadataProviders,
                         TvDbProvider tvDbProvider)
 {
     _database = database;
     _metadataProviders = metadataProviders;
     _tvDbProvider = tvDbProvider;
 }
开发者ID:Normmatt,项目名称:NzbDrone,代码行数:7,代码来源:MetadataProvider.cs


示例5: ShowEmployeesCommand

 public ShowEmployeesCommand(
     string companyName,
     IDatabase db)
     : base(db)
 {
     this.companyName = companyName;
 }
开发者ID:IulianHristov87,项目名称:Homework-SoftUni,代码行数:7,代码来源:ShowEmployeesCommand.cs


示例6: Up

 public void Up(IDatabase db)
 {
     db.CreateTable(FjosTable)
         .WithPrimaryKeyColumn("Id", DbType.Int64).AsIdentity()
         .WithNotNullableColumn("BondegardId", DbType.Int64);
     db.Tables[FjosTable].AddForeignKeyTo(BondegardTable).Through("BondegardId", "Id");
 }
开发者ID:pedershk,项目名称:dotnetprograms,代码行数:7,代码来源:V005_AddFjos_5.cs


示例7: Up

        public void Up(IDatabase db)
        {
            if (!this.IsFeatureSupported(db))
            {
                return;
            }
            MySqlHelper.ActivateStrictMode(db);

            db.CreateTable(Tables[0].Name)
              .WithPrimaryKeyColumn(Tables[0].Columns[0], DbType.Int32).AsIdentity()
              .WithNotNullableColumn(Tables[0].Columns[1], DbType.Decimal).OfSize(3)
              .WithNotNullableColumn(Tables[0].Columns[2], DbType.Decimal).OfSize(5, 2);

            db.Execute(GetInsertStatement((decimal)Tables[0].Value(0, 2) + 0.003m)); // the extra precision should be cut off silently
            db.Execute(context =>
                {
                    IDbCommand command = context.CreateCommand();
                    command.CommandText = GetInsertStatement(1000m);
                    Log.Verbose(LogCategory.Sql, command.CommandText);
                    try
                    {
                        command.ExecuteNonQuery();
                        Assert.Fail("The previous query should have failed.");
                    }
                    catch (Exception x)
                    {
                        if (!x.IsDbException())
                        {
                            throw;
                        }
                    }
                });
        }
开发者ID:dradovic,项目名称:MigSharp,代码行数:33,代码来源:Migration11_Decimals.cs


示例8: SampleDevelopmentEnvironment

 public SampleDevelopmentEnvironment()
 {
     AvailableDatabases = new IDatabase[]
     {
         new SqlServerDatabase("localhost", "Data Source=localhost;Initial Catalog=test;User ID=AppUser;Password=AppUser;MultipleActiveResultSets=True")
     };
 }
开发者ID:giacomelli,项目名称:SpecFlowHelper,代码行数:7,代码来源:SampleDevelopmentEnvironment.cs


示例9: EnsureTransaction

        internal static TransactionContext EnsureTransaction(ref Transaction transaction, IDatabase database)
        {
            TransactionContext result = null;

            if (transaction != null)
            {
                if (transaction.Aborted)
                {
                    throw new System.Transactions.TransactionAbortedException();
                }

                // Just a mock result
                result = new TransactionContext();
            }
            else
            {
                // Create a local transaction for the current operation

                System.Transactions.CommittableTransaction localTransaction = CreateDefaultTransaction();
                transaction = Create(localTransaction);

                result = new TransactionContext(localTransaction);
            }

            transaction.Subscribe(database.DatabaseEngine.TransactionHandler);
            // database.DatabaseEngine.TransactionHandler.EnsureSubscription(transaction);

            return result;
        }
开发者ID:nozerowu,项目名称:ABP,代码行数:29,代码来源:Transaction.cs


示例10: GetAssetFundApply

        /// <summary>
        /// 国资处经费申请内容
        /// </summary>
        /// <param name="request"></param>
        /// <param name="user"></param>
        /// <param name="database"></param>
        /// <returns></returns>
        public static AssetFundApply GetAssetFundApply(this HttpRequest request, User user, IDatabase database)
        {
            var assetFundApply = request.getAssetFundApply(database);
            assetFundApply.Quantity = request.GetInt("Quantity").Value;
            //assetFundApply.BudgetAmount = request.GetInt("BudgetAmount").Value;
            //assetFundApply.BidControlAmount = request.GetInt("BidControlAmount").Value;
            //assetFundApply.DeviceValue = request.GetInt("DeviceValue").Value;
            //assetFundApply.TradeAgentFee = request.GetInt("TradeAgentFee").Value;
            assetFundApply.ApplyTotalAmount = request.GetInt("ApplyTotalAmount").Value;
            if (request.GetBoolean("IsCommit").Value)
            {
                assetFundApply.State = AssetFundApplyState.Submit;
            }else
            {
                assetFundApply.State = AssetFundApplyState.UnSubmit;
            }
            assetFundApply.Operator = user;
            assetFundApply.ModifyTime = DateTime.Now;
            if (assetFundApply.IsNew)
            {
                assetFundApply.OperateTime = DateTime.Now;
            }

            return assetFundApply;
        }
开发者ID:rbmyself,项目名称:ipmsnew,代码行数:32,代码来源:AssetFundApplyExtension.cs


示例11: TestArtist

        private static void TestArtist(IDatabase db, DALFactory dalFactory)
        {
            Console.WriteLine("*************************************");
            Console.WriteLine("ARTIST TEST");

            IArtistDAO artistDAO = dalFactory.CreateArtistDAO(db);

            Console.WriteLine("\nAll artists:");
            foreach (var artist in artistDAO.GetAll()) {
                Console.WriteLine(artist);
            }

            Console.WriteLine("\nArtist with ID=1:");
            Console.WriteLine(artistDAO.GetById(1));

            Artist artist1 = new Artist() {
                Name = "Stefan the Rösch",
                CategoryId = 1,
                CountryId = 25
            };
            Artist newArtist = artistDAO.Create(artist1);
            Console.WriteLine("New Artist: " + newArtist);
            Console.WriteLine("Inserted Artist: " + artist1);

            artist1.Name = "Christoph the Wurst";
            artistDAO.Update(artist1);
            Console.WriteLine("Updated artist: " + artist1);

            artistDAO.Delete(artist1);
            Console.WriteLine("\nArtist deleted");
        }
开发者ID:ChristophWurst,项目名称:UFO,代码行数:31,代码来源:Program.cs


示例12: CashFlowTypesViewModel

        public CashFlowTypesViewModel(IShellViewModel shell, IDatabase database, IConfigurationManager configuration, ICachedService cashedService, IEventAggregator eventAggregator)
            : base(shell, database, configuration, cashedService, eventAggregator)
        {
            SuppressEvent = false;
            _cashFlows = new BindableCollectionExt<CashFlow>();
            _cashFlows.PropertyChanged += (s, e) =>
            {
                OnPropertyChanged(s, e);
                CachedService.Clear(CachedServiceKeys.AllCashFlows);
            };

            _cashFlowGroups = new BindableCollectionExt<CashFlowGroup>();
            _cashFlowGroups.PropertyChanged += (s, e) =>
            {
                if (SuppressEvent == true)
                {
                    return;
                }
                OnPropertyChanged(s, e);

                CachedService.Clear(CachedServiceKeys.AllCashFlowGroups);
                CachedService.Clear(CachedServiceKeys.AllCashFlows);
                var cashFlowGroup = s as CashFlowGroup;
                _cashFlows.Where(x => x.CashFlowGroupId == cashFlowGroup.Id)
                    .ForEach(x => x.Group = cashFlowGroup);
                NewCashFlowGroup = null;
                NewCashFlowGroup = CashFlowGroups.First();
            };
        }
开发者ID:adalbertus,项目名称:BudgetPlanner,代码行数:29,代码来源:CashFlowTypesViewModel.cs


示例13: ResetBlank

        internal static void ResetBlank(IDatabase db)
        {
			/*
            File.Copy(Path.Combine(TestHelpers.TestPaths.TestFolderPath, "src\\App.Config"),
                                Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ica.aps.services.dll.config"), true);
			*/
            if (db.IsSqlServerCeProvider)
            {
                File.Copy(Path.Combine(TestHelpers.TestPaths.TestDataFolderPath, "aps_backup.sdf"),
                                    Path.Combine(TestHelpers.TestPaths.TestDataFolderPath, "aps.sdf"), true);
            }
            else if (db.IsSqlServerProvider)
            {
                using (IDbConnection conn = db.Create())
                {
                    conn.Open();

                    conn.ChangeDatabase("master");
                    conn.Execute("DROP DATABASE aps");
                    conn.Execute("CREATE DATABASE aps");

                    /*
                    string sql = string.Format(@"RESTORE DATABASE {0} FROM DISK = '{1}' WITH REPLACE",
                                                conn.Database,
                                                Path.Combine(TestHelpers.TestPaths.TestDataFolderPath, "aps.bak"));
                    // change to master
                    conn.ChangeDatabase("master");
                    // perform restore
                    conn.Execute(sql);
                    */
                }
            }
        }
开发者ID:jcapuano328,项目名称:aps.mvc,代码行数:33,代码来源:Data.cs


示例14: CommandController

 internal CommandController(IDatabase database, IFileStoreProvider fileStore)
 {
     this.database = database;
     this.fileStore = fileStore;
     var thread = new Thread(SaveLoop);
     thread.Start();
 }
开发者ID:joelthelion,项目名称:Jump-Location,代码行数:7,代码来源:CommandController.cs


示例15: EpisodeProvider

 public EpisodeProvider(IDatabase database, TvDbProvider tvDbProviderProvider,
         SeasonProvider seasonProvider)
 {
     _tvDbProvider = tvDbProviderProvider;
     _seasonProvider = seasonProvider;
     _database = database;
 }
开发者ID:realpatriot,项目名称:NzbDrone,代码行数:7,代码来源:EpisodeProvider.cs


示例16: CreateCompany

 public CreateCompany(IDatabase db, string companyName, string ceoFirstName, string ceoLastName, decimal salary)
     : base(db, companyName)
 {
     this.ceoFirstName = ceoFirstName;
     this.ceoLastName = ceoLastName;
     this.salary = salary;
 }
开发者ID:bobosam,项目名称:CSharpOOP,代码行数:7,代码来源:CreateCompany.cs


示例17: DownloadGroup

 public DownloadGroup(IDatabase db, Security.Group group,
     int sendTimeout, int receiveTimeout, int sendBufferSize, int receiveBufferSize)
     : base(sendTimeout, receiveTimeout, sendBufferSize, receiveBufferSize)
 {
     _db = db;
     _group = group;
 }
开发者ID:274706834,项目名称:opendms-dot-net,代码行数:7,代码来源:DownloadGroup.cs


示例18: EventStore

 public EventStore(
     IEventPublisher publisher,
     IDatabase<EventDescriptors> database)
 {
     _publisher = publisher;
     _database = database;
 }
开发者ID:lukedoolittle,项目名称:SimpleCQRS.Portable,代码行数:7,代码来源:EventStore.cs


示例19: AssertMig20

        private static void AssertMig20(IDatabase db, bool exists)
        {
            if (IntegrationTestContext.IsScripting) return;

            db.Execute(context =>
                {
                    IDbCommand command = context.CreateCommand();
                    command.CommandText = @"SELECT * FROM ""Mig20""";
                    try
                    {
                        context.CommandExecutor.ExecuteNonQuery(command);
                        if (!exists)
                        {
                            Assert.Fail("The table 'Mig20' should not exist at this point.");
                        }
                    }
                    catch (Exception x)
                    {
                        if (!x.IsDbException())
                        {
                            throw;
                        }
                        if (exists)
                        {
                            Assert.Fail("The table 'Mig20' should exist at this point. But there an error occurred: {0}", x.Message);
                        }
                    }
                });
        }
开发者ID:dradovic,项目名称:MigSharp,代码行数:29,代码来源:Migration20_DropIfExists.cs


示例20: LegacySnapshotCreator

 public LegacySnapshotCreator(IStoreEvents store, IDatabase database)
 {
     Contract.Requires<ArgumentNullException>(store != null, "store");
     Contract.Requires<ArgumentNullException>(database != null, "database");
     _store = store;
     _db = database;
 }
开发者ID:jrgcubano,项目名称:CQRS-ES-Todos,代码行数:7,代码来源:LegacySnapshotCreator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IDatabaseCommands类代码示例发布时间:2022-05-24
下一篇:
C# IDataWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap