1 つのトランザクション スコープ内で、2 つの別々の Raven データベース (同じ Raven サーバー上) にデータを保存しようとしています。
ただし、2 番目のセッションでの変更はサーバーに保存されていません。
私が使用しているコードは次のとおりです。
var documentStore = new DocumentStore { Url = "http://localhost:8081/" };
documentStore.Initialize();
documentStore.DatabaseCommands.EnsureDatabaseExists("database1");
documentStore.DatabaseCommands.EnsureDatabaseExists("database2");
using (var ts = new TransactionScope(TransactionScopeOption.RequiresNew))
{
using (var session1 = documentStore.OpenSession("database1"))
{
session1.Store(new Entity {Id = "1"});
session1.SaveChanges();
}
using (var session2 = documentStore.OpenSession("database2"))
{
session2.Store(new Entity {Id = "2"});
session2.SaveChanges();
}
ts.Complete();
}
に保存されている の変更を確認できますが、 の変更はにsession1
保存されません。RavenDbビルド992とビルド2360で試しましたdatabase1
session2
database2
Raven のドキュメントによると、データベース間のトランザクションがサポートされています。
session2
変更をコミットするにはどうすればよいですか?