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
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
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
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
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.