Class MySQLServiceCollectionExtensions
MySQL extension class for Microsoft.
Inheritance
Namespace: MySql.EntityFrameworkCore.Extensions
Assembly: MySql.EntityFrameworkCore.dll
Version: 9.3.0
Syntax
public static class MySQLServiceCollectionExtensions
Methods
AddEntityFrameworkMySQL(IServiceCollection)
Adds the services required by the MySQL database provider for Entity Framework
to an Microsoft.
Warning: Do not call this method by mistake. Instead, it is more likely that you need to call AddMySQLServer<TContext>(IServiceCollection, String, Action<MySQLDbContextOptionsBuilder>, Action<DbContextOptionsBuilder>).
Calling this method is no longer necessary when building most applications, including those that
use dependency injection in ASP.NET or elsewhere.
It is only needed when building the internal service provider for use with
the Microsoft.
Declaration
public static IServiceCollection AddEntityFrameworkMySQL(this IServiceCollection services)
Parameters
Type | Name | Description |
---|---|---|
Microsoft. |
services | The Microsoft. |
Returns
Type | Description |
---|---|
Microsoft. |
The same service collection so that multiple calls can be chained. |
AddMySQLServer<TContext>(IServiceCollection, String, Action<MySQLDbContextOptionsBuilder>, Action<DbContextOptionsBuilder>)
Registers the given Entity Framework Microsoft.
This method is a shortcut for configuring a Microsoft.
Use this method when using dependency injection in your application, such as with ASP.NET Core.
For applications that don't use dependency injection, consider creating Microsoft.
To configure the Microsoft.
See Using DbContext with dependency injection for more information.
Declaration
public static IServiceCollection AddMySQLServer<TContext>(this IServiceCollection serviceCollection, string connectionString, Action<MySQLDbContextOptionsBuilder> sqlServerOptionsAction = null, Action<DbContextOptionsBuilder> optionsAction = null)
where TContext : DbContext
Parameters
Type | Name | Description |
---|---|---|
Microsoft. |
serviceCollection | The Microsoft. |
System. |
connectionString | The connection string of the database to connect to. |
System. |
sqlServerOptionsAction | An optional action to enable additional MySQL server-specific configuration. |
System. |
optionsAction | An optional action to configure the Microsoft. |
Returns
Type | Description |
---|---|
Microsoft. |
The same service collection so that multiple calls can be chained. |
Type Parameters
Name | Description |
---|---|
TContext | The type of context to be registered. |