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


C# Storage.Batch方法代码示例

本文整理汇总了C#中Storage.Batch方法的典型用法代码示例。如果您正苦于以下问题:C# Storage.Batch方法的具体用法?C# Storage.Batch怎么用?C# Storage.Batch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Storage的用法示例。


在下文中一共展示了Storage.Batch方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Putting_two_documents_with_same_key_in_overlapping_transactions_throws_exception

 public void Putting_two_documents_with_same_key_in_overlapping_transactions_throws_exception()
 {
     var storage = new Storage();
     Exception thrown = null;
     storage.Batch(x=> {
       x.Put("1", "Hello");
       try {
     storage.Batch(y=> y.Put("1", "Another"));
       } catch(Exception ex) {
     thrown = ex;
       }
     });
     Assert.NotNull(thrown);
 }
开发者ID:robashton,项目名称:leveldb-play,代码行数:14,代码来源:Test.cs

示例2: Deleting_updating_document_before_update_transaction_is_closed_throws_exception

 public void Deleting_updating_document_before_update_transaction_is_closed_throws_exception()
 {
     var storage = new Storage();
     storage.Batch(x=> x.Put("1", "Hello"));
     Exception thrown = null;
     storage.Batch(x=> {
       x.Put("1", "Overwrite");
       try {
     storage.Batch(y=> y.Delete("1"));
       } catch(Exception ex) {
     thrown = ex;
       }
     });
     Assert.NotNull(thrown);
 }
开发者ID:robashton,项目名称:leveldb-play,代码行数:15,代码来源:Test.cs

示例3: Can_store_multiple_document

    public void Can_store_multiple_document()
    {
        var storage = new Storage();
        storage.Batch(x=>  {
          x.Put("1", "Hello");
          x.Put("2", "Hello World");
        });

        string doc1 = null;
        string doc2 = null;
        storage.Batch(x=> {
          doc1 = (string)x.Get("1");
          doc2 = (string)x.Get("2");
        });
        Assert.That(doc1, Is.EqualTo("Hello"));
        Assert.That(doc2, Is.EqualTo("Hello World"));
    }
开发者ID:robashton,项目名称:leveldb-play,代码行数:17,代码来源:Test.cs

示例4: Can_store_single_document

    public void Can_store_single_document()
    {
        var storage = new Storage();
        storage.Batch(x=> x.Put("1", "Hello"));

        string doc = null;
        storage.Batch(x=> {
          doc = (string)x.Get("1");
        });
        Assert.That(doc, Is.EqualTo("Hello"));
    }
开发者ID:robashton,项目名称:leveldb-play,代码行数:11,代码来源:Test.cs

示例5: A_concurrency_exception_leaves_the_database_in_a_usable_state

 public void A_concurrency_exception_leaves_the_database_in_a_usable_state()
 {
     var storage = new Storage();
     Exception thrown = null;
     storage.Batch(x=> {
       x.Put("1", "Hello");
       try {
     storage.Batch(y=> y.Put("1", "Another"));
       } catch(Exception ex) {
     thrown = ex;
       }
     });
     storage.Batch(x=> x.Put("1", "Replaced"));
     string doc = null;
     storage.Batch(x=> {
       doc = (string)x.Get("1");
     });
     Assert.That(doc, Is.EqualTo("Replaced"));
     Assert.NotNull(thrown);
 }
开发者ID:robashton,项目名称:leveldb-play,代码行数:20,代码来源:Test.cs


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