Skip to content

Commit 718da89

Browse files
authored
Update README.md
Removed old documentation
1 parent b89be63 commit 718da89

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed

README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,6 @@ Triggers will be executed in that order: First those for `IAnimal`, then those f
115115
In addition to inheritance
116116
and the order in which triggers are registered, a trigger can also implement the `ITriggerPriority` interface. This allows a trigger to configure a custom priority (default: 0). Triggers will then be executed in order of their priority (lower goes first). This means that a trigger for Cat can execute before a trigger for Animal, for as long as its priority is set to run earlier. A convenient set of priorities are exposed in the `CommonTriggerPriority` class
117117

118-
### Dependency injection
119-
Triggers shine in combination with DI. When configured, triggers are resolved from the same ServiceProvider that was used to resolve your DbContext. This means that lifetimes are shared between triggers and your services. For this to work, you'll have to ensure that EntityFrameworkCore.Triggered is able to resolve the IServiceProvider used to obtain the DbContext instance:
120-
121-
- RECOMMENDED: Use `services.AddTriggeredDbContext<MyDbContext>()` instead of `services.AddDbContext<MyDbContext>()` (with overloads for pooled/factory registrations also available).
122-
- TriggeredDbContext implements a constructor overload that accepts an IServiceProvider. Your derived class can implement a constructor that accepts an IServiceProvider as well and forward that to the base class constructor. This will make sure that when you use DependencyInjection through `services.AddDbContext<MyTriggeredDbContext>()`, the ServiceProvider that is used to resolve the DbContext will be sent in as an argument for the ServiceProvider. Note that this does not work for pooled contexts since those are shared and essentially behave as a singleton.
123-
- Configure a method that returns the current relevant ServiceProvider. This can be done by providing a method through: `triggerOptions.UseApplicationScopedServiceProviderAccessor(sp => ...)`. The first argument will be either the application ServiceProvider if available or otherwise the internal service provider.
124-
- DEPRECATED: Use one of our integration packages. Currently we only support direct integration with ASP.NET Core through the [EntityFrameworkCore.Triggered.AspNetCore](https://www.nuget.org/packages/EntityFrameworkCore.Triggered.AspNetCore/) nuget package. This will use the IHttpContextAccessor to access the scoped ServiceProvider of the current request. To use this, please make sure to either call: `services.AddAspNetCoreTriggeredDbContext<MyTriggeredDbContext>()` or `triggerOptions.UseAspNetCoreIntegration()`.
125-
126118
### Error handling
127119
In some cases, you want to be triggered when a DbUpdateException occurs. For this purpose we have `IAfterSaveFailedTrigger<TEntity>`. This gets triggered for all entities as part of the change set when DbContext.SaveChanges raises a DbUpdateException. The handling method: `AfterSaveFailed` in turn gets called with the trigger context containing the entity as well as the exception. You may attempt to call `DbContext.SaveChanges` again from within this trigger. This will not raise triggers that are already raised and only raise triggers that have since become relevant (based on the cascading configuration).
128120

0 commit comments

Comments
 (0)