瀏覽代碼

update samples

master
Savorboard 6 年之前
父節點
當前提交
797b1f71ba
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. +2
    -2
      samples/Sample.RabbitMQ.MongoDB/Controllers/ValuesController.cs

+ 2
- 2
samples/Sample.RabbitMQ.MongoDB/Controllers/ValuesController.cs 查看文件

@@ -26,7 +26,7 @@ namespace Sample.RabbitMQ.MongoDB.Controllers
//mycollection.InsertOne(new BsonDocument { { "test", "test" } });

using (var session = _client.StartSession())
using (var trans = _capPublisher.CapTransaction.Begin(session))
using (var trans = _capPublisher.Transaction.Begin(session))
{
var collection = _client.GetDatabase("test").GetCollection<BsonDocument>("test.collection");
collection.InsertOne(session, new BsonDocument { { "hello", "world" } });
@@ -42,7 +42,7 @@ namespace Sample.RabbitMQ.MongoDB.Controllers
public IActionResult PublishNotAutoCommit()
{
using (var session = _client.StartSession())
using (_capPublisher.CapTransaction.Begin(session, true))
using (_capPublisher.Transaction.Begin(session, true))
{
var collection = _client.GetDatabase("test").GetCollection<BsonDocument>("test.collection");
collection.InsertOne(session, new BsonDocument { { "hello2", "world2" } });


Loading…
取消
儲存