Table of Contents

Class NpgsqlConventionSetBuilder

Namespace
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.Conventions
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.dll

A builder for building conventions for Npgsql.

public class NpgsqlConventionSetBuilder : RelationalConventionSetBuilder, IProviderConventionSetBuilder
Inheritance
NpgsqlConventionSetBuilder
Implements
Inherited Members

Remarks

The service lifetime is Scoped and multiple registrations are allowed. This means that each DbContext instance will use its own set of instances of this service. The implementations may depend on other services registered with any lifetime. The implementations do not need to be thread-safe.

See Model building conventions, and

Constructors

NpgsqlConventionSetBuilder(ProviderConventionSetBuilderDependencies, RelationalConventionSetBuilderDependencies, IRelationalTypeMappingSource, INpgsqlSingletonOptions)

Creates a new NpgsqlConventionSetBuilder instance.

public NpgsqlConventionSetBuilder(ProviderConventionSetBuilderDependencies dependencies, RelationalConventionSetBuilderDependencies relationalDependencies, IRelationalTypeMappingSource typeMappingSource, INpgsqlSingletonOptions npgsqlSingletonOptions)

Parameters

dependencies ProviderConventionSetBuilderDependencies

The core dependencies for this service.

relationalDependencies RelationalConventionSetBuilderDependencies

The relational dependencies for this service.

typeMappingSource IRelationalTypeMappingSource

The type mapping source to use.

npgsqlSingletonOptions INpgsqlSingletonOptions

The singleton options to use.

Methods

Build()

Call this method to build a ConventionSet for Npgsql when using the ModelBuilder outside of OnModelCreating(ModelBuilder).

Note that it is unusual to use this method. Consider using DbContext in the normal way instead.

public static ConventionSet Build()

Returns

ConventionSet

The convention set.

CreateConventionSet()

Builds and returns the convention set for the current database provider.

public override ConventionSet CreateConventionSet()

Returns

ConventionSet

The convention set for the current database provider.

CreateModelBuilder()

Call this method to build a ModelBuilder for Npgsql outside of OnModelCreating(ModelBuilder).

Note that it is unusual to use this method. Consider using DbContext in the normal way instead.

public static ModelBuilder CreateModelBuilder()

Returns

ModelBuilder

The convention set.