Browse Source

Document OnConfiguring options in EF Core setup

pull/24343/head
maliming 3 months ago
parent
commit
8b4e12efa2
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 11
      docs/en/framework/data/entity-framework-core/index.md

11
docs/en/framework/data/entity-framework-core/index.md

@ -146,7 +146,7 @@ Configure<AbpDbContextOptions>(options =>
}); });
```` ````
Add actions for the `ConfigureConventions` and `OnModelCreating` methods of the `DbContext` as shown below: Add actions for the `ConfigureConventions`, `OnModelCreating` and `OnConfiguring` methods of the `DbContext` as shown below:
````csharp ````csharp
Configure<AbpDbContextOptions>(options => Configure<AbpDbContextOptions>(options =>
@ -170,6 +170,15 @@ Configure<AbpDbContextOptions>(options =>
{ {
// This action is called for OnModelCreating method of specific DbContext. // This action is called for OnModelCreating method of specific DbContext.
}); });
options.ConfigureDefaultOnConfiguring((dbContext, optionsBuilder) =>
{
// This action is called for OnConfiguring method of all DbContexts.
});
options.ConfigureOnConfiguring<YourDbContext>((dbContext, optionsBuilder) =>
{
// This action is called for OnConfiguring method of specific DbContext.
});
}); });
```` ````

Loading…
Cancel
Save