Search code examples
c#transactionsdapperisolation-leveldbconnection

Is there a way to read UNCOMMITTED rows only in dapper?


I have already set the isolation level to IsolationLevel.ReadUncommitted is there an option to fetch uncommitted data only? Without manually altering Stored Procs to be called?

Below is the script for fetching uncommitted data only:

SELECT * FROM Users.[User]
 EXCEPT
SELECT * FROM Users.[User] WITH (READCOMMITTED, READPAST)

Solution

  • Dapper doesn't really have anything to do with this. There are two options here:

    • if your SQL flavor (backend-dependent) allows you to express this: great
    • if your ADO.NET connection/transaction (provider-dependent) supports this: great

    Dapper simply doesn't have any relation to either. It sits on top of the provider, and the calling code provides the syntax.