Db Context File Settings

Settings for describing your basic database information and adding a DbContext to your Web API.

Db Context

An object that describes the basic information for your database. At the moment, only one application DbContext is supported per API.

NameRequiredDescriptionDefault
DbContextNameYesA single key value pair that designates the name you want to use for your API.None
DatabaseNameYesThe name of your database.None
ProviderNoAn enumerator that designated the database provider for your DbContext. Case insensitive.SqlServer
NamingConventionNoThe naming convention for your database. Case insensitive.SnakeCase

Providers

These are the valid options for the Provider property:

  • SqlServer
  • Postgres
  • MySQL (Coming Soon)

You can still add MySql to your project manually. It has not been built in directly yet because, as of writing this, the MySQl nuget package is currently in pre-release, so you'll either want to add the prerelease or drop back to .NET Core 3.1 until it's ready.

Naming Conventions

  • Class uses the built in .NET styling
  • SnakeCase
  • LowerCase
  • CamelCase
  • UpperCase

Example

In this example, we are creating a Sql Server database with a database name of VetClinic and a DbContext of VetClinicDbContext.

DbContext:
  ContextName: VetClinicDbContext
  DatabaseName: VetClinic
  Provider: SqlServer