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
modelBuilder
IConventionModelBuilderThe model builder.
collation
stringThe collation.
fromDataAnnotation
boolIndicates 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
modelBuilder
IConventionModelBuilderThe model builder.
schema
stringThe default schema.
fromDataAnnotation
boolIndicates 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
modelBuilder
IConventionModelBuilderThe model builder.
length
int?The value to set.
fromDataAnnotation
boolIndicates 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
modelBuilder
IConventionModelBuilderThe model builder.
methodInfo
MethodInfoThe method this function uses.
fromDataAnnotation
boolIndicates 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
modelBuilder
IConventionModelBuilderThe model builder.
name
stringThe name of the function.
returnType
TypeThe function's return type.
fromDataAnnotation
boolIndicates 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
modelBuilder
ModelBuilderThe model builder.
methodInfo
MethodInfoThe 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
modelBuilder
ModelBuilderThe model builder.
methodInfo
MethodInfoThe methodInfo this dbFunction uses.
builderAction
Action<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
modelBuilder
ModelBuilderThe model builder.
expression
Expression<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
modelBuilder
IConventionModelBuilderThe model builder.
schema
stringThe default schema.
fromDataAnnotation
boolIndicates 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
modelBuilder
ModelBuilderThe model builder.
schema
stringThe 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
modelBuilder
IConventionModelBuilderThe model builder.
length
int?The value to set.
fromDataAnnotation
boolIndicates 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
modelBuilder
IConventionModelBuilderThe model builder.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
fromDataAnnotation
boolIndicates 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
modelBuilder
ModelBuilderThe model builder.
name
stringThe name of the sequence.
builderAction
Action<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
modelBuilder
ModelBuilderThe model builder.
name
stringThe name of the sequence.
schema
stringThe 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
modelBuilder
ModelBuilderThe model builder.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
builderAction
Action<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
modelBuilder
ModelBuilderThe model builder.
type
TypeThe type of values the sequence will generate.
name
stringThe name of the sequence.
builderAction
Action<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
modelBuilder
ModelBuilderThe model builder.
type
TypeThe type of values the sequence will generate.
name
stringThe name of the sequence.
schema
stringThe 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
modelBuilder
ModelBuilderThe model builder.
type
TypeThe type of values the sequence will generate.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
builderAction
Action<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
modelBuilder
ModelBuilderThe model builder.
name
stringThe name of the sequence.
builderAction
Action<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Type Parameters
T
The 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
modelBuilder
ModelBuilderThe model builder.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
Returns
- SequenceBuilder
A builder to further configure the sequence.
Type Parameters
T
The 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
modelBuilder
ModelBuilderThe model builder.
name
stringThe name of the sequence.
schema
stringThe schema of the sequence.
builderAction
Action<SequenceBuilder>An action that performs configuration of the sequence.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.
Type Parameters
T
The 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
modelBuilder
IConventionModelBuilderThe model builder.
collation
stringThe collation.
fromDataAnnotation
boolIndicates 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
modelBuilder
ModelBuilderThe model builder.
collation
stringThe collation.
Returns
- ModelBuilder
The same builder instance so that multiple calls can be chained.