Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Edited Issue: Auto-register SqlAzureExecutionStrategy for SQL Server EF provider [1283]

$
0
0
Related to [item #1255](https://entityframework.codeplex.com/workitem/1255) on making it possible to suspend/resume an execution strategy, we could make the following design changes for RTM:

- Have SqlProviderServices to always resolve to a factory of SqlAzureExecutionStrategy
- Add a flag to context configuration to specify if retries should be used
- Change the constructor of the execution strategy instance to obtain the current value of the flag from the context (e.g. it could take a context instance or just a Func<bool>)
- Make RetriesOnFailure reflect the value of the flag passed to the execution strategy
- Change the code on the Execute methods of the Execution strategy to only retry if RetriesOnFailure returns true.
- Push as much of this functionality as we can down to DbExecutionStrategy

This would make it unnecessary to register an execution strategy manually and the user would instead just need to set a flag on the context to enable retries, e.g.:

```
public class MyAzureContext: DbContext
{

public MyAzureContext(): base()
{
Configuration.RetriesOnFailureEnabled = true;
}
}

```
Since this would remove the need to register a service from the most common paths it would make it more ok for us to get rid of the DbProviderNameAttribute ([issue 1281](https://entityframework.codeplex.com/workitem/1281)).

Note that once we do something like this, we should probably consider renaming the strategy to be just SqlExecutionStrategy or something similar.

We should discuss other alternative designs that might help us attain the same goals.

Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>