0

Is there any way in which I can modify all, or a specific Breeze query, to query with NoLock on?

So far I have tried two approaches.

The first approach consisted of deriving from BreezeConfig - similar to https://github.com/IdeaBlade/Breeze/blob/master/_Internal/Sample_WebApi/Controllers/BreezeConfig.cs

then overriding GetTransactionSettings as follows, hoping that all queries will now be wrapped by transactions.

    public override TransactionSettings GetTransactionSettings()
    {
        var settings = base.GetTransactionSettings();
        settings.TransactionType = TransactionType.TransactionScope;
        settings.IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted;
        return settings;
    }

Sql profiler shows me that my reads aren't wrapped in transactions :/

The second approach I tried is to modify EFContextProvider's behaviour. This failed - the only hooks I can find, even if I derive, are for modifying save-changes. Nothing for read-only behaviour.

Im still investigating Jay's suggestion. But I probably have no idea what i'm doing.

AGhosT
  • 113
  • 1
  • 11

1 Answers1

0

If you are using the EFContextProvider then I don't think so because Entity Framework doesn't provide this capability.

However you can intercept the transaction processing on the server to accomplish something similar.

Take a look at this post: Entity Framework with NOLOCK

Community
  • 1
  • 1
Jay Traband
  • 17,053
  • 1
  • 23
  • 44