Class MySqlDbContextOptionsExtensions
Inheritance
Namespace: Steeltoe.Connector.MySql.EFCore
Assembly: Steeltoe.Connector.EFCore.dll
Syntax
public static class MySqlDbContextOptionsExtensions : object
Methods
| Edit this page View SourceUseMySql(DbContextOptionsBuilder, IConfiguration, Object)
Configure Entity Framework Core to use a MySQL database
Declaration
public static DbContextOptionsBuilder UseMySql(this DbContextOptionsBuilder optionsBuilder, IConfiguration config, object mySqlOptionsAction = null)
Parameters
Type | Name | Description |
---|---|---|
DbContextOptionsBuilder | optionsBuilder | |
IConfiguration | config | Application configuration |
System.Object | mySqlOptionsAction | An action for customizing the MySqlDbContextOptionsBuilder |
Returns
Type | Description |
---|---|
DbContextOptionsBuilder |
Remarks
When used with EF Core 5.0, this method may result in the use of ServerVersion.AutoDetect(), which opens an extra connection to the server.
Pass in a ServerVersion to avoid the extra DB Connection - see https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1088#issuecomment-726091533
UseMySql(DbContextOptionsBuilder, IConfiguration, Object, Object)
Configure Entity Framework Core to use a MySQL database
Declaration
public static DbContextOptionsBuilder UseMySql(this DbContextOptionsBuilder optionsBuilder, IConfiguration config, object serverVersion, object mySqlOptionsAction = null)
Parameters
Type | Name | Description |
---|---|---|
DbContextOptionsBuilder | optionsBuilder | |
IConfiguration | config | Application configuration |
System.Object | serverVersion | The version of MySQL/MariaDB to connect to (introduced in EF Core 5.0) |
System.Object | mySqlOptionsAction | An action for customizing the MySqlDbContextOptionsBuilder |
Returns
Type | Description |
---|---|
DbContextOptionsBuilder |
UseMySql(DbContextOptionsBuilder, IConfiguration, String, Object)
Configure Entity Framework Core to use a MySQL database identified by a named service binding
Declaration
public static DbContextOptionsBuilder UseMySql(this DbContextOptionsBuilder optionsBuilder, IConfiguration config, string serviceName, object mySqlOptionsAction = null)
Parameters
Type | Name | Description |
---|---|---|
DbContextOptionsBuilder | optionsBuilder | |
IConfiguration | config | Application configuration |
System.String | serviceName | The name of the service binding to use |
System.Object | mySqlOptionsAction | An action for customizing the MySqlDbContextOptionsBuilder |
Returns
Type | Description |
---|---|
DbContextOptionsBuilder |
Remarks
When used with EF Core 5.0, this method may result in the use of ServerVersion.AutoDetect(), which opens an extra connection to the server.
Pass in a ServerVersion to avoid the extra DB Connection - see https://github.com/PomeloFoundation/Pomelo.EntityFrameworkCore.MySql/issues/1088#issuecomment-726091533
UseMySql(DbContextOptionsBuilder, IConfiguration, String, Object, Object)
Configure Entity Framework Core to use a MySQL database identified by a named service binding
Declaration
public static DbContextOptionsBuilder UseMySql(this DbContextOptionsBuilder optionsBuilder, IConfiguration config, string serviceName, object serverVersion, object mySqlOptionsAction = null)
Parameters
Type | Name | Description |
---|---|---|
DbContextOptionsBuilder | optionsBuilder | |
IConfiguration | config | Application configuration |
System.String | serviceName | The name of the service binding to use |
System.Object | serverVersion | The version of MySQL/MariaDB to connect to (introduced in EF Core 5.0) |
System.Object | mySqlOptionsAction | An action for customizing the MySqlDbContextOptionsBuilder |
Returns
Type | Description |
---|---|
DbContextOptionsBuilder |
UseMySql<TContext>(DbContextOptionsBuilder<TContext>, IConfiguration, Object, Object)
Configure Entity Framework Core to use a MySQL database
Declaration
public static DbContextOptionsBuilder<TContext> UseMySql<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder, IConfiguration config, object mySqlOptionsAction = null, object serverVersion = null)
where TContext : DbContext
Parameters
Type | Name | Description |
---|---|---|
DbContextOptionsBuilder<TContext> | optionsBuilder | |
IConfiguration | config | Application configuration |
System.Object | mySqlOptionsAction | An action for customizing the MySqlDbContextOptionsBuilder |
System.Object | serverVersion | The version of MySQL/MariaDB to connect to (introduced in EF Core 5.0) |
Returns
Type | Description |
---|---|
DbContextOptionsBuilder<TContext> |
Type Parameters
Name | Description |
---|---|
TContext | Type of |
UseMySql<TContext>(DbContextOptionsBuilder<TContext>, IConfiguration, String, Object, Object)
Configure Entity Framework Core to use a MySQL database identified by a named service binding
Declaration
public static DbContextOptionsBuilder<TContext> UseMySql<TContext>(this DbContextOptionsBuilder<TContext> optionsBuilder, IConfiguration config, string serviceName, object mySqlOptionsAction = null, object serverVersion = null)
where TContext : DbContext
Parameters
Type | Name | Description |
---|---|---|
DbContextOptionsBuilder<TContext> | optionsBuilder | |
IConfiguration | config | Application configuration |
System.String | serviceName | The name of the service binding to use |
System.Object | mySqlOptionsAction | An action for customizing the MySqlDbContextOptionsBuilder |
System.Object | serverVersion | The version of MySQL/MariaDB to connect to (introduced in EF Core 5.0) |
Returns
Type | Description |
---|---|
DbContextOptionsBuilder<TContext> |
Type Parameters
Name | Description |
---|---|
TContext | Type of |