Class RelationalModelBuilderExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Relational database specific extension methods for Microsoft.EntityFrameworkCore.ModelBuilder.
public static class RelationalModelBuilderExtensions
- Inheritance
-
RelationalModelBuilderExtensions
- Inherited Members
Remarks
See Modeling entity types and relationships for more information and examples.
Methods
CanSetCollation(IConventionModelBuilder, string?, bool)
Returns a value indicating whether the given collation can be set as default.
public static bool CanSetCollation(this IConventionModelBuilder modelBuilder, string? collation, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
collationstringThe collation.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Database collations for more information and examples.
CanSetDefaultSchema(IConventionModelBuilder, string?, bool)
Returns a value indicating whether the given schema can be set as default.
public static bool CanSetDefaultSchema(this IConventionModelBuilder modelBuilder, string? schema, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
schemastringThe default schema.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
CanSetMaxIdentifierLength(IConventionModelBuilder, int?, bool)
Returns a value indicating whether the maximum length allowed for store identifiers can be set.
public static bool CanSetMaxIdentifierLength(this IConventionModelBuilder modelBuilder, int? length, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
lengthint?The value to set.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
HasDbFunction(IConventionModelBuilder, MethodInfo, bool)
Configures a relational database function.
public static IConventionDbFunctionBuilder HasDbFunction(this IConventionModelBuilder modelBuilder, MethodInfo methodInfo, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
methodInfoMethodInfoThe method this function uses.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionDbFunctionBuilder
A builder to further configure the function.
Remarks
See Database functions for more information and examples.
HasDbFunction(IConventionModelBuilder, string, Type, bool)
Configures a relational database function.
public static IConventionDbFunctionBuilder HasDbFunction(this IConventionModelBuilder modelBuilder, string name, Type returnType, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
namestringThe name of the function.
returnTypeTypeThe function's return type.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionDbFunctionBuilder
A builder to further configure the function.
Remarks
See Database functions for more information and examples.
HasDbFunction(ModelBuilder, MethodInfo)
Configures a database function when targeting a relational database.
public static DbFunctionBuilder HasDbFunction(this ModelBuilder modelBuilder, MethodInfo methodInfo)
Parameters
modelBuilderModelBuilderThe model builder.
methodInfoMethodInfoThe methodInfo this dbFunction uses.
Returns
- DbFunctionBuilder
A builder to further configure the function.
Remarks
See Database functions for more information and examples.
HasDbFunction(ModelBuilder, MethodInfo, Action<DbFunctionBuilder>)
Configures a database function when targeting a relational database.
public static ModelBuilder HasDbFunction(this ModelBuilder modelBuilder, MethodInfo methodInfo, Action<DbFunctionBuilder> builderAction)
Parameters
modelBuilderModelBuilderThe model builder.
methodInfoMethodInfoThe methodInfo this dbFunction uses.
builderActionAction<DbFunctionBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
A builder to further configure the function.
Remarks
See Database functions for more information and examples.
HasDbFunction<TResult>(ModelBuilder, Expression<Func<TResult>>)
Configures a database function when targeting a relational database.
public static DbFunctionBuilder HasDbFunction<TResult>(this ModelBuilder modelBuilder, Expression<Func<TResult>> expression)
Parameters
modelBuilderModelBuilderThe model builder.
expressionExpression<Func<TResult>>The method this dbFunction uses.
Returns
- DbFunctionBuilder
A builder to further configure the function.
Type Parameters
TResult
Remarks
See Database functions for more information and examples.
HasDefaultSchema(IConventionModelBuilder, string?, bool)
Configures the default schema that database objects should be created in, if no schema is explicitly configured.
public static IConventionModelBuilder? HasDefaultSchema(this IConventionModelBuilder modelBuilder, string? schema, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
schemastringThe default schema.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionModelBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
HasDefaultSchema(ModelBuilder, string?)
Configures the default schema that database objects should be created in, if no schema is explicitly configured.
public static ModelBuilder HasDefaultSchema(this ModelBuilder modelBuilder, string? schema)
Parameters
modelBuilderModelBuilderThe model builder.
schemastringThe default schema.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
HasMaxIdentifierLength(IConventionModelBuilder, int?, bool)
Configures the maximum length allowed for store identifiers.
public static IConventionModelBuilder? HasMaxIdentifierLength(this IConventionModelBuilder modelBuilder, int? length, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
lengthint?The value to set.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionModelBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
HasSequence(IConventionModelBuilder, string, string?, bool)
Configures a database sequence when targeting a relational database.
public static IConventionSequenceBuilder HasSequence(this IConventionModelBuilder modelBuilder, string name, string? schema = null, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionSequenceBuilder
A builder to further configure the sequence.
Remarks
See Database sequences for more information and examples.
HasSequence(ModelBuilder, string, Action<SequenceBuilder>)
Configures a database sequence when targeting a relational database.
public static ModelBuilder HasSequence(this ModelBuilder modelBuilder, string name, Action<SequenceBuilder> builderAction)
Parameters
modelBuilderModelBuilderThe model builder.
namestringThe name of the sequence.
builderActionAction<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database sequences for more information and examples.
HasSequence(ModelBuilder, string, string?)
Configures a database sequence when targeting a relational database.
public static SequenceBuilder HasSequence(this ModelBuilder modelBuilder, string name, string? schema = null)
Parameters
modelBuilderModelBuilderThe model builder.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
Returns
- SequenceBuilder
A builder to further configure the sequence.
Remarks
See Database sequences for more information and examples.
HasSequence(ModelBuilder, string, string?, Action<SequenceBuilder>)
Configures a database sequence when targeting a relational database.
public static ModelBuilder HasSequence(this ModelBuilder modelBuilder, string name, string? schema, Action<SequenceBuilder> builderAction)
Parameters
modelBuilderModelBuilderThe model builder.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
builderActionAction<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database sequences for more information and examples.
HasSequence(ModelBuilder, Type, string, Action<SequenceBuilder>)
Configures a database sequence when targeting a relational database.
public static ModelBuilder HasSequence(this ModelBuilder modelBuilder, Type type, string name, Action<SequenceBuilder> builderAction)
Parameters
modelBuilderModelBuilderThe model builder.
typeTypeThe type of values the sequence will generate.
namestringThe name of the sequence.
builderActionAction<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database sequences for more information and examples.
HasSequence(ModelBuilder, Type, string, string?)
Configures a database sequence when targeting a relational database.
public static SequenceBuilder HasSequence(this ModelBuilder modelBuilder, Type type, string name, string? schema = null)
Parameters
modelBuilderModelBuilderThe model builder.
typeTypeThe type of values the sequence will generate.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
Returns
- SequenceBuilder
A builder to further configure the sequence.
Remarks
See Database sequences for more information and examples.
HasSequence(ModelBuilder, Type, string, string?, Action<SequenceBuilder>)
Configures a database sequence when targeting a relational database.
public static ModelBuilder HasSequence(this ModelBuilder modelBuilder, Type type, string name, string? schema, Action<SequenceBuilder> builderAction)
Parameters
modelBuilderModelBuilderThe model builder.
typeTypeThe type of values the sequence will generate.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
builderActionAction<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database sequences for more information and examples.
HasSequence<T>(ModelBuilder, string, Action<SequenceBuilder>)
Configures a database sequence when targeting a relational database.
public static ModelBuilder HasSequence<T>(this ModelBuilder modelBuilder, string name, Action<SequenceBuilder> builderAction)
Parameters
modelBuilderModelBuilderThe model builder.
namestringThe name of the sequence.
builderActionAction<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Type Parameters
TThe type of values the sequence will generate.
Remarks
See Database sequences for more information and examples.
HasSequence<T>(ModelBuilder, string, string?)
Configures a database sequence when targeting a relational database.
public static SequenceBuilder HasSequence<T>(this ModelBuilder modelBuilder, string name, string? schema = null)
Parameters
modelBuilderModelBuilderThe model builder.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
Returns
- SequenceBuilder
A builder to further configure the sequence.
Type Parameters
TThe type of values the sequence will generate.
Remarks
See Database sequences for more information and examples.
HasSequence<T>(ModelBuilder, string, string?, Action<SequenceBuilder>)
Configures a database sequence when targeting a relational database.
public static ModelBuilder HasSequence<T>(this ModelBuilder modelBuilder, string name, string? schema, Action<SequenceBuilder> builderAction)
Parameters
modelBuilderModelBuilderThe model builder.
namestringThe name of the sequence.
schemastringThe schema of the sequence.
builderActionAction<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Type Parameters
TThe type of values the sequence will generate.
Remarks
See Database sequences for more information and examples.
UseCollation(IConventionModelBuilder, string?, bool)
Configures the database collation, which will be used by all columns without an explicit collation.
public static IConventionModelBuilder? UseCollation(this IConventionModelBuilder modelBuilder, string? collation, bool fromDataAnnotation = false)
Parameters
modelBuilderIConventionModelBuilderThe model builder.
collationstringThe collation.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionModelBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Database collations for more information and examples.
UseCollation(ModelBuilder, string?)
Configures the database collation, which will be used by all columns without an explicit collation.
public static ModelBuilder UseCollation(this ModelBuilder modelBuilder, string? collation)
Parameters
modelBuilderModelBuilderThe model builder.
collationstringThe collation.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Database collations for more information and examples.