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


C# IDatabase类代码示例

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


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


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