Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2014 in memory table and transactions

I'm using Entity Framework 6.1.0 with SQL Server 2014.

I'm attempting to perform several operations under a transaction which i've created like this:

(var transaction = context.Database.BeginTransaction())
{


}

But I'm getting an error

Accessing memory optimized tables using the READ COMMITTED isolation level is supported only for autocommit transactions. It is not supported for explicit or implicit transactions. Provide a supported isolation level for the memory optimized table using a table hint, such as WITH (SNAPSHOT).

I have tried all possible isolation levels (those allowed for in memory tables) but to no avail.

How can I perform atomic transactions from code with in memory tables?

like image 540
user3065280 Avatar asked Nov 01 '22 01:11

user3065280


1 Answers

The solution was to enable MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT

Resource: http://msdn.microsoft.com/en-us/library/dn133175(v=sql.120).aspx

like image 68
user3065280 Avatar answered Nov 15 '22 04:11

user3065280