DbContexts
The dbContexts section allows you to define the database data contexts for your entities.
Here you configure all needed features for your entities administration at runtime, including: map entities with their database objects, define the objects relationships and data persistence.
Fields
A dbContext contains the following fields to be defined:
Name
The name of dbContext to be created.
Requirements Rules:
- Is Required;
- Must not be a Reserved Keyword;
- Must start with a letter;
- Must contains only letters, numbers and the underline char ('_');
- Max length of 50 chars
Example:
1 2 |
|
DatabaseName
The name of database to which the dbContext refers.
Requirements Rules:
- Is Required;
- The name must be exist in Databases list in the current model;
- See Databases section for more details.
Example:
1 2 3 |
|
DefaultSchema
Specifies the database schema to be used for all tables, documents and objects whose schema is not specified at the creation time.
_NOTE: MySql does not support the EF Core concept of schemas. Therefore, this property will be ignored if it is informed for MySql instances. For more info, see the MySql Schema Glossary.
Requirements Rules:
- Must start with a letter;
- Must contains only letters, numbers and the underline char ('_');
- Only allowed for relational database instance types;
Example:
1 2 3 4 |
|
DbMappings
The list of entity mappings for this dbContext.
Requirements Rules:
- DbMapping is allowed only for relational database instance types;
- Each dbMapping must have an exclusive 'Name' property value;
- Each dbMapping on list must follows rules as specified in DbMapping;
Example:
1 2 3 4 5 6 7 8 9 |
|
Complete Example
See below for a complete example, containing all the properties for the DbContexts section.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|