Skip to content

IDbCommandInterceptor!#16113

Merged
ajcvickers merged 1 commit intomasterfrom
CalabiYauManifold0527
Jun 18, 2019
Merged

IDbCommandInterceptor!#16113
ajcvickers merged 1 commit intomasterfrom
CalabiYauManifold0527

Conversation

@ajcvickers
Copy link
Contributor

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.

@ajcvickers ajcvickers force-pushed the CalabiYauManifold0527 branch from fccc1e3 to f5e663c Compare June 16, 2019 13:57
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 😉

@ajcvickers ajcvickers force-pushed the CalabiYauManifold0527 branch from f5e663c to 4312a94 Compare June 17, 2019 23:47
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 force-pushed the CalabiYauManifold0527 branch from 4312a94 to c89f015 Compare June 18, 2019 15:28
@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