29 lines
2.0 KiB
Markdown
29 lines
2.0 KiB
Markdown
#### [Pf2eModel](index.md 'index')
|
|
### [Pf2eModel](Pf2eModel.md 'Pf2eModel').[Pf2eDbContext](Pf2eDbContext.md 'Pf2eModel\.Pf2eDbContext')
|
|
|
|
## Pf2eDbContext\.OnModelCreating\(ModelBuilder\) Method
|
|
|
|
Override this method to further configure the model that was discovered by convention from the entity types
|
|
exposed in [Microsoft\.EntityFrameworkCore\.DbSet<>](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbSet-1 'Microsoft\.EntityFrameworkCore\.DbSet\`1') properties on your derived context\. The resulting model may be cached
|
|
and re\-used for subsequent instances of your derived context\.
|
|
|
|
```csharp
|
|
protected override void OnModelCreating(Microsoft.EntityFrameworkCore.ModelBuilder modelBuilder);
|
|
```
|
|
#### Parameters
|
|
|
|
<a name='Pf2eModel.Pf2eDbContext.OnModelCreating(Microsoft.EntityFrameworkCore.ModelBuilder).modelBuilder'></a>
|
|
|
|
`modelBuilder` [Microsoft\.EntityFrameworkCore\.ModelBuilder](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.ModelBuilder 'Microsoft\.EntityFrameworkCore\.ModelBuilder')
|
|
|
|
The builder being used to construct the model for this context\. Databases \(and other extensions\) typically
|
|
define extension methods on this object that allow you to configure aspects of the model that are specific
|
|
to a given database\.
|
|
|
|
### Remarks
|
|
|
|
If a model is explicitly set on the options for this context (via [Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\.UseModel\(Microsoft\.EntityFrameworkCore\.Metadata\.IModel\)](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContextOptionsBuilder.UseModel#Microsoft_EntityFrameworkCore_DbContextOptionsBuilder_UseModel_Microsoft_EntityFrameworkCore_Metadata_IModel_ 'Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\.UseModel\(Microsoft\.EntityFrameworkCore\.Metadata\.IModel\)'))
|
|
then this method will not be run. However, it will still run when creating a compiled model.
|
|
|
|
See [Modeling entity types and relationships](https://aka.ms/efcore-docs-modeling 'https://aka\.ms/efcore\-docs\-modeling') for more information and
|
|
examples. |