本文整理汇总了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;
}
示例2: OrderRepo
public OrderRepo(IDatabase database)
{
if (database == null)
throw new ArgumentNullException("database");
_Database = database;
}
示例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);
}
示例4: MetadataProvider
public MetadataProvider(IDatabase database, IEnumerable<MetadataBase> metadataProviders,
TvDbProvider tvDbProvider)
{
_database = database;
_metadataProviders = metadataProviders;
_tvDbProvider = tvDbProvider;
}
示例5: ShowEmployeesCommand
public ShowEmployeesCommand(
string companyName,
IDatabase db)
: base(db)
{
this.companyName = companyName;
}
示例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");
}
示例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;
}
}
});
}
示例8: SampleDevelopmentEnvironment
public SampleDevelopmentEnvironment()
{
AvailableDatabases = new IDatabase[]
{
new SqlServerDatabase("localhost", "Data Source=localhost;Initial Catalog=test;User ID=AppUser;Password=AppUser;MultipleActiveResultSets=True")
};
}
示例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;
}
示例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;
}
示例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");
}
示例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();
};
}
示例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);
*/
}
}
}
示例14: CommandController
internal CommandController(IDatabase database, IFileStoreProvider fileStore)
{
this.database = database;
this.fileStore = fileStore;
var thread = new Thread(SaveLoop);
thread.Start();
}
示例15: EpisodeProvider
public EpisodeProvider(IDatabase database, TvDbProvider tvDbProviderProvider,
SeasonProvider seasonProvider)
{
_tvDbProvider = tvDbProviderProvider;
_seasonProvider = seasonProvider;
_database = database;
}