Rıfat Erdem Sahin
Rıfat Erdem Sahin

Reputation: 1778

Ravendb and SQL Server in a transaction

i want to write an insert/update/delete statement that will insert/update/delete into ravendb and sql server at the same time.I want to be consistent at my updates,inserts and deletes.

how is it possible ? should i use msdtc ?

Upvotes: 1

Views: 314

Answers (1)

Matt Johnson-Pint
Matt Johnson-Pint

Reputation: 241573

You can always wrap your code in a TransactionScope. Both RavenDB and SQL Server will pick up on it.

using (var ts = new TransactionScope())
{
    ... SQL Stuff ...

    ... Raven Stuff ...

    ts.Complete();
}

You should read this and this.

But you might get better results just working with RavenDB in your application and then replicating to SQL Server. Read here.

Upvotes: 2

Related Questions