本文整理汇总了C#中BerkeleyDB.DatabaseEntry.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# DatabaseEntry.GetType方法的具体用法?C# DatabaseEntry.GetType怎么用?C# DatabaseEntry.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BerkeleyDB.DatabaseEntry
的用法示例。
在下文中一共展示了DatabaseEntry.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Put
/// <summary>
/// Protected wrapper for DB->put. Used by subclasses for access method
/// specific operations.
/// </summary>
/// <param name="key">The key to store in the database</param>
/// <param name="data">The data item to store in the database</param>
/// <param name="txn">Transaction with which to protect the put</param>
/// <param name="flags">Flags to pass to DB->put</param>
protected void Put(DatabaseEntry key,
DatabaseEntry data, Transaction txn, uint flags)
{
System.Type type = key.GetType();
if (type == typeof(MultipleDatabaseEntry))
flags |= DbConstants.DB_MULTIPLE;
else if (type == typeof(MultipleKeyDatabaseEntry))
flags |= DbConstants.DB_MULTIPLE_KEY;
db.put(Transaction.getDB_TXN(txn), key, data, flags);
}
示例2: Delete
/// <summary>
/// Remove key/data pairs from the database. If <paramref name="key"/>
/// is DatabaseEntry, the key/data pair associated with
/// <paramref name="key"/> is discarded from the database. In the
/// presence of duplicate key values, all records associated with the
/// designated key will be discarded. If <paramref name="key"/> is
/// MultipleDatabaseEntry, delete multiple data items using keys from
/// the buffer to which the key parameter refers. If
/// <paramref name="key"/> is MultipleKeyDatabaseEntry, delete multiple
/// data items using keys and data from the buffer to which the key
/// parameter refers.
/// </summary>
/// <remarks>
/// <para>
/// When called on a secondary database, remove the key/data pairs from
/// the primary database and all secondary indices.
/// </para>
/// <para>
/// If <paramref name="txn"/> is null and the operation occurs in a
/// transactional database, the operation will be implicitly transaction
/// protected.
/// </para>
/// </remarks>
/// <param name="key">
/// Discard the key/data pairs associated with <paramref name="key"/>.
/// </param>
/// <param name="txn">
/// If the operation is part of an application-specified transaction,
/// <paramref name="txn"/> is a Transaction object returned from
/// <see cref="DatabaseEnvironment.BeginTransaction"/>; if
/// the operation is part of a Berkeley DB Concurrent Data Store group,
/// <paramref name="txn"/> is a handle returned from
/// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null.
/// </param>
/// <exception cref="NotFoundException">
/// A NotFoundException is thrown if <paramref name="key"/> is not in
/// the database.
/// </exception>
/// <exception cref="KeyEmptyException">
/// A KeyEmptyException is thrown if the database is a
/// <see cref="QueueDatabase"/> or <see cref="RecnoDatabase"/>
/// database and <paramref name="key"/> exists, but was never explicitly
/// created by the application or was later deleted.
/// </exception>
public void Delete(DatabaseEntry key, Transaction txn)
{
uint flags = 0;
System.Type type = key.GetType();
if (type == typeof(MultipleDatabaseEntry))
flags |= DbConstants.DB_MULTIPLE;
else if (type == typeof(MultipleKeyDatabaseEntry))
flags |= DbConstants.DB_MULTIPLE_KEY;
db.del(Transaction.getDB_TXN(txn), key, flags);
}