Share via


ProviderCodeGenerator Class

Definition

Generates provider-specific code fragments.

[System.Runtime.CompilerServices.Nullable(0)]
public abstract class ProviderCodeGenerator : Microsoft.EntityFrameworkCore.Scaffolding.IProviderConfigurationCodeGenerator
public abstract class ProviderCodeGenerator : Microsoft.EntityFrameworkCore.Scaffolding.IProviderConfigurationCodeGenerator
[<System.Runtime.CompilerServices.Nullable(0)>]
type ProviderCodeGenerator = class
    interface IProviderConfigurationCodeGenerator
type ProviderCodeGenerator = class
    interface IProviderConfigurationCodeGenerator
Public MustInherit Class ProviderCodeGenerator
Implements IProviderConfigurationCodeGenerator
Inheritance
ProviderCodeGenerator
Attributes
Implements

Remarks

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

See Reverse engineering (scaffolding) an existing database, and EF Core design-time services for more information and examples.

Constructors

Name Description
ProviderCodeGenerator(ProviderCodeGeneratorDependencies)

Initializes a new instance of the ProviderCodeGenerator class.

Properties

Name Description
Dependencies

Relational provider-specific dependencies for this service.

Methods

Name Description
GenerateContextOptions()

Generates a method chain to configure additional context options.

GenerateProviderOptions()

Generates a method chain used to configure provider-specific options.

GenerateUseProvider(String, MethodCallCodeFragment)

Generates a code fragment like .UseSqlServer("Database=Foo") which can be used in the OnConfiguring(DbContextOptionsBuilder) method of the generated DbContext.

GenerateUseProvider(String)
Obsolete.

Generates a code fragment like .UseSqlServer("Database=Foo") which can be used in the OnConfiguring(DbContextOptionsBuilder) method of the generated DbContext.

Applies to