Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDbCommandInterceptor! #16113

Merged
merged 1 commit into from
Jun 18, 2019
Merged

IDbCommandInterceptor! #16113

merged 1 commit into from
Jun 18, 2019

Conversation

ajcvickers
Copy link
Member

Fixes #15066

The general idea is the same as IDbCommandInterceptor in EF6.

Specifically:

  • Command interceptors can be used to view, change, or suppress execution of the DbCommand and to modify the result before it is returned to EF.
    DbCommandInterceptor is provided as an abstract base class.
  • Example of registration:
builder.UseSqlServer(
    myConnectionString,
	b => b.CommandInterceptor(myInterceptor);
  • Multiple interceptors can be composed using the CompositeDbCommandInterceptor.
  • Extensions can also register interceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the
    order that they are resolved from the service provider, and then the application interceptor is run last.

Copy link
Member

@AndriySvyryd AndriySvyryd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weekend well spent 😉

Fixes #15066

The general idea is the same as `IDbCommandInterceptor` in EF6.

Specifically:
* Command interceptors can be used to view, change, or suppress execution of the `DbCommand` and to modify the result before it is returned to EF.
`DbCommandInterceptor` is provided as an abstract base class.
* Example of registration:
```C#
builder.UseSqlServer(
    myConnectionString,
	b => b.CommandInterceptor(myInterceptor);
```
* Multiple interceptors can be composed using the `CompositeDbCommandInterceptor`.
* Extensions can also register interceptors in the internal service provider. If both injected and application interceptors are found, then the injected interceptors are run in the
order that they are resolved from the service provider, and then the application interceptor is run last.
@ajcvickers ajcvickers merged commit 7839c87 into master Jun 18, 2019
@ghost ghost deleted the CalabiYauManifold0527 branch June 18, 2019 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add IDbCommandInterceptor or similar to allow injecting custom query execution service
3 participants