Browse Source
Document OnConfiguring options in EF Core setup
pull/24343/head
maliming
3 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
10 additions and
1 deletions
-
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. |
|
|
|
|
|
}); |
|
|
}); |
|
|
}); |
|
|
```` |
|
|
```` |
|
|
|
|
|
|
|
|
|