本文整理汇总了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);
}
示例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);
}
示例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"));
}
示例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"));
}
示例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);
}