30 lines
2.4 KiB
Markdown
30 lines
2.4 KiB
Markdown
#### [Pf2e\.Database](index.md 'index')
|
|
### [Pf2e\.Database](Pf2e.Database.md 'Pf2e\.Database').[Pf2eDbContext](Pf2eDbContext.md 'Pf2e\.Database\.Pf2eDbContext')
|
|
|
|
## Pf2eDbContext\.OnConfiguring\(DbContextOptionsBuilder\) Method
|
|
|
|
Override this method to configure the database \(and other options\) to be used for this context\.
|
|
This method is called for each instance of the context that is created\.
|
|
The base implementation does nothing\.
|
|
|
|
```csharp
|
|
protected override void OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder optionsBuilder);
|
|
```
|
|
#### Parameters
|
|
|
|
<a name='Pf2e.Database.Pf2eDbContext.OnConfiguring(Microsoft.EntityFrameworkCore.DbContextOptionsBuilder).optionsBuilder'></a>
|
|
|
|
`optionsBuilder` [Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontextoptionsbuilder 'Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder')
|
|
|
|
A builder used to create or modify options for this context\. Databases \(and other extensions\)
|
|
typically define extension methods on this object that allow you to configure the context\.
|
|
|
|
### Remarks
|
|
|
|
In situations where an instance of [Microsoft\.EntityFrameworkCore\.DbContextOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontextoptions 'Microsoft\.EntityFrameworkCore\.DbContextOptions') may or may not have been passed
|
|
to the constructor, you can use [Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\.IsConfigured](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontextoptionsbuilder.isconfigured 'Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\.IsConfigured') to determine if
|
|
the options have already been set, and skip some or all of the logic in
|
|
[Microsoft\.EntityFrameworkCore\.DbContext\.OnConfiguring\(Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\)](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.onconfiguring#microsoft-entityframeworkcore-dbcontext-onconfiguring(microsoft-entityframeworkcore-dbcontextoptionsbuilder) 'Microsoft\.EntityFrameworkCore\.DbContext\.OnConfiguring\(Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\)').
|
|
|
|
See [DbContext lifetime, configuration, and initialization](https://aka.ms/efcore-docs-dbcontext 'https://aka\.ms/efcore\-docs\-dbcontext')
|
|
for more information and examples. |