# Class NpgsqlValueGenerationStrategyConvention

Namespace
  Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.Conventions

Assembly
  Npgsql.EntityFrameworkCore.PostgreSQL.dll

A convention that configures the default model NpgsqlValueGenerationStrategy as IdentityByDefaultColumn for newer PostgreSQL versions, and SerialColumn for pre-10.0 versions.

    public class NpgsqlValueGenerationStrategyConvention : IModelInitializedConvention, IModelFinalizingConvention, IConvention

Inheritance
  object
  NpgsqlValueGenerationStrategyConvention

Implements
  IModelInitializedConvention
  IModelFinalizingConvention
  IConvention

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## Constructors

### NpgsqlValueGenerationStrategyConvention(ProviderConventionSetBuilderDependencies, RelationalConventionSetBuilderDependencies, Version?)

Creates a new instance of NpgsqlValueGenerationStrategyConvention.

    public NpgsqlValueGenerationStrategyConvention(ProviderConventionSetBuilderDependencies dependencies, RelationalConventionSetBuilderDependencies relationalDependencies, Version? postgresVersion)

#### Parameters

`dependencies` ProviderConventionSetBuilderDependencies

  Parameter object containing dependencies for this convention.

`relationalDependencies` RelationalConventionSetBuilderDependencies

  Parameter object containing relational dependencies for this convention.

`postgresVersion` Version

  The PostgreSQL version being targeted. This affects the default value generation strategy.

## Properties

### Dependencies

Parameter object containing service dependencies.

    protected virtual ProviderConventionSetBuilderDependencies Dependencies { get; }

#### Property Value

ProviderConventionSetBuilderDependencies

### RelationalDependencies

Relational provider-specific dependencies for this service.

    protected virtual RelationalConventionSetBuilderDependencies RelationalDependencies { get; }

#### Property Value

RelationalConventionSetBuilderDependencies

## Methods

### ProcessModelFinalizing(IConventionModelBuilder, IConventionContext<IConventionModelBuilder>)

Called when a model is being finalized.

    public virtual void ProcessModelFinalizing(IConventionModelBuilder modelBuilder, IConventionContext<IConventionModelBuilder> context)

#### Parameters

`modelBuilder` IConventionModelBuilder

  The builder for the model.

`context` IConventionContext<IConventionModelBuilder>

  Additional information associated with convention execution.

### ProcessModelInitialized(IConventionModelBuilder, IConventionContext<IConventionModelBuilder>)

Called after a model is initialized.

    public virtual void ProcessModelInitialized(IConventionModelBuilder modelBuilder, IConventionContext<IConventionModelBuilder> context)

#### Parameters

`modelBuilder` IConventionModelBuilder

  The builder for the model.

`context` IConventionContext<IConventionModelBuilder>

  Additional information associated with convention execution.