Документация

This commit is contained in:
2025-10-04 22:52:22 +04:00
parent 5ded786397
commit 318abe541c
1224 changed files with 4656 additions and 4233 deletions
+10 -10
View File
@@ -10,7 +10,7 @@ instances of your entities\. DbContext is a combination of the Unit Of Work and
public class Pf2eDbContext : Microsoft.EntityFrameworkCore.DbContext
```
Inheritance [System\.Object](https://docs.microsoft.com/en-us/dotnet/api/System.Object 'System\.Object') 🡒 [Microsoft\.EntityFrameworkCore\.DbContext](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContext 'Microsoft\.EntityFrameworkCore\.DbContext') 🡒 Pf2eDbContext
Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') 🡒 [Microsoft\.EntityFrameworkCore\.DbContext](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext 'Microsoft\.EntityFrameworkCore\.DbContext') 🡒 Pf2eDbContext
### Remarks
@@ -20,19 +20,19 @@ Therefore, always await async calls immediately, or use separate DbContext insta
in parallel. See [Avoiding DbContext threading issues](https://aka.ms/efcore-docs-threading 'https://aka\.ms/efcore\-docs\-threading') for more information
and examples.
Typically you create a class that derives from DbContext and contains [Microsoft\.EntityFrameworkCore\.DbSet<>](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbSet-1 'Microsoft\.EntityFrameworkCore\.DbSet\`1')
properties for each entity in the model. If the [Microsoft\.EntityFrameworkCore\.DbSet<>](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbSet-1 'Microsoft\.EntityFrameworkCore\.DbSet\`1') properties have a public setter,
Typically you create a class that derives from DbContext and contains [Microsoft\.EntityFrameworkCore\.DbSet<>](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbset-1 'Microsoft\.EntityFrameworkCore\.DbSet\`1')
properties for each entity in the model. If the [Microsoft\.EntityFrameworkCore\.DbSet<>](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbset-1 'Microsoft\.EntityFrameworkCore\.DbSet\`1') properties have a public setter,
they are automatically initialized when the instance of the derived context is created.
Override the [Microsoft\.EntityFrameworkCore\.DbContext\.OnConfiguring\(Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\)](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContext.OnConfiguring#Microsoft_EntityFrameworkCore_DbContext_OnConfiguring_Microsoft_EntityFrameworkCore_DbContextOptionsBuilder_ 'Microsoft\.EntityFrameworkCore\.DbContext\.OnConfiguring\(Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\)') method to configure the database (and
Override the [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\)') method to configure the database (and
other options) to be used for the context. Alternatively, if you would rather perform configuration externally
instead of inline in your context, you can use [Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder<>](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContextOptionsBuilder-1 'Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\`1')
(or [Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContextOptionsBuilder 'Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder')) to externally create an instance of [Microsoft\.EntityFrameworkCore\.DbContextOptions<>](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContextOptions-1 'Microsoft\.EntityFrameworkCore\.DbContextOptions\`1')
(or [Microsoft\.EntityFrameworkCore\.DbContextOptions](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContextOptions 'Microsoft\.EntityFrameworkCore\.DbContextOptions')) and pass it to a base constructor of [Microsoft\.EntityFrameworkCore\.DbContext](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContext 'Microsoft\.EntityFrameworkCore\.DbContext').
instead of inline in your context, you can use [Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder<>](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontextoptionsbuilder-1 'Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\`1')
(or [Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontextoptionsbuilder 'Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder')) to externally create an instance of [Microsoft\.EntityFrameworkCore\.DbContextOptions<>](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontextoptions-1 'Microsoft\.EntityFrameworkCore\.DbContextOptions\`1')
(or [Microsoft\.EntityFrameworkCore\.DbContextOptions](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontextoptions 'Microsoft\.EntityFrameworkCore\.DbContextOptions')) and pass it to a base constructor of [Microsoft\.EntityFrameworkCore\.DbContext](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext 'Microsoft\.EntityFrameworkCore\.DbContext').
The model is discovered by running a set of conventions over the entity classes found in the
[Microsoft\.EntityFrameworkCore\.DbSet<>](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbSet-1 'Microsoft\.EntityFrameworkCore\.DbSet\`1') properties on the derived context. To further configure the model that
is discovered by convention, you can override the [Microsoft\.EntityFrameworkCore\.DbContext\.OnModelCreating\(Microsoft\.EntityFrameworkCore\.ModelBuilder\)](https://docs.microsoft.com/en-us/dotnet/api/Microsoft.EntityFrameworkCore.DbContext.OnModelCreating#Microsoft_EntityFrameworkCore_DbContext_OnModelCreating_Microsoft_EntityFrameworkCore_ModelBuilder_ 'Microsoft\.EntityFrameworkCore\.DbContext\.OnModelCreating\(Microsoft\.EntityFrameworkCore\.ModelBuilder\)') method.
[Microsoft\.EntityFrameworkCore\.DbSet<>](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbset-1 'Microsoft\.EntityFrameworkCore\.DbSet\`1') properties on the derived context. To further configure the model that
is discovered by convention, you can override the [Microsoft\.EntityFrameworkCore\.DbContext\.OnModelCreating\(Microsoft\.EntityFrameworkCore\.ModelBuilder\)](https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.dbcontext.onmodelcreating#microsoft-entityframeworkcore-dbcontext-onmodelcreating(microsoft-entityframeworkcore-modelbuilder) 'Microsoft\.EntityFrameworkCore\.DbContext\.OnModelCreating\(Microsoft\.EntityFrameworkCore\.ModelBuilder\)') method.
See [DbContext lifetime, configuration, and initialization](https://aka.ms/efcore-docs-dbcontext 'https://aka\.ms/efcore\-docs\-dbcontext'),
[Querying data with EF Core](https://aka.ms/efcore-docs-query 'https://aka\.ms/efcore\-docs\-query'),
@@ -59,4 +59,4 @@ See [DbContext lifetime, configuration, and initialization](https://aka.ms/efcor
| [LocaleSearch\(LocaleString, string\)](Pf2eDbContext.LocaleSearch(LocaleString,string).md 'Pf2e\.Database\.Pf2eDbContext\.LocaleSearch\(Pf2e\.Database\.Model\.Common\.I18n\.LocaleString, string\)') | CLR\-представление функции поиска в локализованной строке\. |
| [LocaleSearchArray\(LocaleString, IEnumerable&lt;string&gt;\)](Pf2eDbContext.LocaleSearchArray(LocaleString,IEnumerable_string_).md 'Pf2e\.Database\.Pf2eDbContext\.LocaleSearchArray\(Pf2e\.Database\.Model\.Common\.I18n\.LocaleString, System\.Collections\.Generic\.IEnumerable\<string\>\)') | CLR\-представление функции поиска в локализованной строке с массивом значений для поиска\. |
| [OnConfiguring\(DbContextOptionsBuilder\)](Pf2eDbContext.OnConfiguring(DbContextOptionsBuilder).md 'Pf2e\.Database\.Pf2eDbContext\.OnConfiguring\(Microsoft\.EntityFrameworkCore\.DbContextOptionsBuilder\)') | 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\. |
| [OnModelCreating\(ModelBuilder\)](Pf2eDbContext.OnModelCreating(ModelBuilder).md 'Pf2e\.Database\.Pf2eDbContext\.OnModelCreating\(Microsoft\.EntityFrameworkCore\.ModelBuilder\)') | Override this method to further configure the model that was discovered by convention from the entity types exposed in [Microsoft\.EntityFrameworkCore\.DbSet&lt;&gt;](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\. |
| [OnModelCreating\(ModelBuilder\)](Pf2eDbContext.OnModelCreating(ModelBuilder).md 'Pf2e\.Database\.Pf2eDbContext\.OnModelCreating\(Microsoft\.EntityFrameworkCore\.ModelBuilder\)') | Override this method to further configure the model that was discovered by convention from the entity types exposed in [Microsoft\.EntityFrameworkCore\.DbSet&lt;&gt;](https://learn.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\. |