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


C# DatabaseEntry.GetType方法代码示例

本文整理汇总了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);
 }
开发者ID:simonzhangsm,项目名称:h-store,代码行数:18,代码来源:Database.cs

示例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);
 }
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:54,代码来源:BaseDatabase.cs


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