Class RelationalModelExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Relational-specific extension methods for Microsoft.EntityFrameworkCore.Metadata.IModel and extension methods for IRelationalModel.
public static class RelationalModelExtensions
- Inheritance
-
RelationalModelExtensions
- Inherited Members
Methods
AddDbFunction(IConventionModel, MethodInfo, bool)
Creates an IConventionDbFunction mapped to the given method.
public static IConventionDbFunction AddDbFunction(this IConventionModel model, MethodInfo methodInfo, bool fromDataAnnotation = false)
Parameters
model
IConventionModelThe model to add the function to.
methodInfo
MethodInfoThe MethodInfo for the method that is mapped to the function.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
AddDbFunction(IConventionModel, string, Type, bool)
Creates an IConventionDbFunction.
public static IConventionDbFunction AddDbFunction(this IConventionModel model, string name, Type returnType, bool fromDataAnnotation = false)
Parameters
model
IConventionModelThe model to add the function to.
name
stringThe model name of the function.
returnType
TypeThe function return type.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
AddDbFunction(IMutableModel, MethodInfo)
Creates an IMutableDbFunction mapped to the given method.
public static IMutableDbFunction AddDbFunction(this IMutableModel model, MethodInfo methodInfo)
Parameters
model
IMutableModelThe model to add the function to.
methodInfo
MethodInfoThe MethodInfo for the method that is mapped to the function.
Returns
- IMutableDbFunction
The new IMutableDbFunction.
AddDbFunction(IMutableModel, string, Type)
Creates an IMutableDbFunction.
public static IMutableDbFunction AddDbFunction(this IMutableModel model, string name, Type returnType)
Parameters
model
IMutableModelThe model to add the function to.
name
stringThe model name of the function.
returnType
TypeThe function return type.
Returns
- IMutableDbFunction
The new IMutableDbFunction.
AddSequence(IConventionModel, string, string, bool)
Either returns the existing IMutableSequence with the given name in the given schema or creates a new sequence with the given name and schema.
public static IConventionSequence AddSequence(this IConventionModel model, string name, string schema = null, bool fromDataAnnotation = false)
Parameters
model
IConventionModelThe model to add the sequence to.
name
stringThe sequence name.
schema
stringThe schema name, or null to use the default schema.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionSequence
The sequence.
AddSequence(IMutableModel, string, string)
Either returns the existing IMutableSequence with the given name in the given schema or creates a new sequence with the given name and schema.
public static IMutableSequence AddSequence(this IMutableModel model, string name, string schema = null)
Parameters
model
IMutableModelThe model to add the sequence to.
name
stringThe sequence name.
schema
stringThe schema name, or null to use the default schema.
Returns
- IMutableSequence
The sequence.
FindDbFunction(IConventionModel, MethodInfo)
Finds a IConventionDbFunction that is mapped to the method represented by the given MethodInfo.
public static IConventionDbFunction FindDbFunction(this IConventionModel model, MethodInfo method)
Parameters
model
IConventionModelThe model to find the function in.
method
MethodInfoThe MethodInfo for the method that is mapped to the function.
Returns
- IConventionDbFunction
The IConventionDbFunction or null if the method is not mapped.
FindDbFunction(IConventionModel, string)
Finds an IConventionDbFunction that is mapped to the method represented by the given name.
public static IConventionDbFunction FindDbFunction(this IConventionModel model, string name)
Parameters
model
IConventionModelThe model to find the function in.
name
stringThe model name of the function.
Returns
- IConventionDbFunction
The IConventionDbFunction or null if the method is not mapped.
FindDbFunction(IModel, MethodInfo)
Finds a IDbFunction that is mapped to the method represented by the given MethodInfo.
public static IDbFunction FindDbFunction(this IModel model, MethodInfo method)
Parameters
model
IModelThe model to find the function in.
method
MethodInfoThe MethodInfo for the method that is mapped to the function.
Returns
- IDbFunction
The IDbFunction or null if the method is not mapped.
FindDbFunction(IModel, string)
Finds an IDbFunction that is mapped to the method represented by the given name.
public static IDbFunction FindDbFunction(this IModel model, string name)
Parameters
model
IModelThe model to find the function in.
name
stringThe model name of the function.
Returns
- IDbFunction
The IDbFunction or null if the method is not mapped.
FindDbFunction(IMutableModel, MethodInfo)
Finds a IMutableDbFunction that is mapped to the method represented by the given MethodInfo.
public static IMutableDbFunction FindDbFunction(this IMutableModel model, MethodInfo method)
Parameters
model
IMutableModelThe model to find the function in.
method
MethodInfoThe MethodInfo for the method that is mapped to the function.
Returns
- IMutableDbFunction
The IMutableDbFunction or null if the method is not mapped.
FindDbFunction(IMutableModel, string)
Finds an IMutableDbFunction that is mapped to the method represented by the given name.
public static IMutableDbFunction FindDbFunction(this IMutableModel model, string name)
Parameters
model
IMutableModelThe model to find the function in.
name
stringThe model name of the function.
Returns
- IMutableDbFunction
The IMutableDbFunction or null if the method is not mapped.
FindSequence(IConventionModel, string, string)
Finds an IConventionSequence with the given name.
public static IConventionSequence FindSequence(this IConventionModel model, string name, string schema = null)
Parameters
model
IConventionModelThe model to find the sequence in.
name
stringThe sequence name.
schema
stringThe schema that contains the sequence.
Returns
- IConventionSequence
The IConventionSequence or null if no sequence with the given name in the given schema was found.
FindSequence(IModel, string, string)
Finds an ISequence with the given name.
public static ISequence FindSequence(this IModel model, string name, string schema = null)
Parameters
model
IModelThe model to find the sequence in.
name
stringThe sequence name.
schema
stringThe schema that contains the sequence.
Returns
FindSequence(IMutableModel, string, string)
Finds an IMutableSequence with the given name.
public static IMutableSequence FindSequence(this IMutableModel model, string name, string schema = null)
Parameters
model
IMutableModelThe model to find the sequence in.
name
stringThe sequence name.
schema
stringThe schema that contains the sequence.
Returns
- IMutableSequence
The IMutableSequence or null if no sequence with the given name in the given schema was found.
GetCollation(IModel)
Returns the database collation.
public static string GetCollation(this IModel model)
Parameters
model
IModelThe model to get the collation for.
Returns
- string
The collation.
GetCollationConfigurationSource(IConventionModel)
Returns the configuration source for the collation.
public static ConfigurationSource? GetCollationConfigurationSource(this IConventionModel model)
Parameters
model
IConventionModelThe model to find configuration source for.
Returns
- ConfigurationSource?
The configuration source for the collation.
GetDbFunctions(IConventionModel)
Returns all IConventionDbFunctions contained in the model.
public static IEnumerable<IConventionDbFunction> GetDbFunctions(this IConventionModel model)
Parameters
model
IConventionModelThe model to get the functions in.
Returns
GetDbFunctions(IModel)
Returns all IDbFunctions contained in the model.
public static IEnumerable<IDbFunction> GetDbFunctions(this IModel model)
Parameters
model
IModelThe model to get the functions in.
Returns
GetDbFunctions(IMutableModel)
Returns all IMutableDbFunctions contained in the model.
public static IEnumerable<IMutableDbFunction> GetDbFunctions(this IMutableModel model)
Parameters
model
IMutableModelThe model to get the functions in.
Returns
GetDefaultSchema(IModel)
Returns the default schema to use for the model, or null if none has been set.
public static string GetDefaultSchema(this IModel model)
Parameters
model
IModelThe model to get the default schema for.
Returns
- string
The default schema.
GetDefaultSchemaConfigurationSource(IConventionModel)
Returns the configuration source for the default schema.
public static ConfigurationSource? GetDefaultSchemaConfigurationSource(this IConventionModel model)
Parameters
model
IConventionModelThe model to find configuration source for.
Returns
- ConfigurationSource?
The configuration source for the default schema.
GetMaxIdentifierLength(IModel)
Returns the maximum length allowed for store identifiers.
public static int GetMaxIdentifierLength(this IModel model)
Parameters
model
IModelThe model to get the maximum identifier length for.
Returns
- int
The maximum identifier length.
GetMaxIdentifierLengthConfigurationSource(IConventionModel)
Returns the configuration source for GetMaxIdentifierLength(IModel).
public static ConfigurationSource? GetMaxIdentifierLengthConfigurationSource(this IConventionModel model)
Parameters
model
IConventionModelThe model to find configuration source for.
Returns
- ConfigurationSource?
The configuration source for GetMaxIdentifierLength(IModel).
GetRelationalModel(IModel)
Returns the database model.
public static IRelationalModel GetRelationalModel(this IModel model)
Parameters
model
IModelThe model to get the database model for.
Returns
- IRelationalModel
The database model.
GetSequences(IConventionModel)
Returns all IConventionSequences contained in the model.
public static IEnumerable<IConventionSequence> GetSequences(this IConventionModel model)
Parameters
model
IConventionModelThe model to get the sequences in.
Returns
GetSequences(IModel)
Returns all ISequences contained in the model.
public static IEnumerable<ISequence> GetSequences(this IModel model)
Parameters
model
IModelThe model to get the sequences in.
Returns
GetSequences(IMutableModel)
Returns all IMutableSequences contained in the model.
public static IEnumerable<IMutableSequence> GetSequences(this IMutableModel model)
Parameters
model
IMutableModelThe model to get the sequences in.
Returns
RemoveDbFunction(IConventionModel, MethodInfo)
Removes the IConventionDbFunction that is mapped to the method represented by the given MethodInfo.
public static IConventionDbFunction RemoveDbFunction(this IConventionModel model, MethodInfo method)
Parameters
model
IConventionModelThe model to find the function in.
method
MethodInfoThe MethodInfo for the method that is mapped to the function.
Returns
- IConventionDbFunction
The removed IConventionDbFunction or null if the method is not mapped.
RemoveDbFunction(IConventionModel, string)
Removes the IConventionDbFunction that is mapped to the method represented by the given MethodInfo.
public static IConventionDbFunction RemoveDbFunction(this IConventionModel model, string name)
Parameters
model
IConventionModelThe model to find the function in.
name
stringThe model name of the function.
Returns
- IConventionDbFunction
The removed IConventionDbFunction or null if the method is not mapped.
RemoveDbFunction(IMutableModel, MethodInfo)
Removes the IMutableDbFunction that is mapped to the method represented by the given MethodInfo.
public static IMutableDbFunction RemoveDbFunction(this IMutableModel model, MethodInfo method)
Parameters
model
IMutableModelThe model to find the function in.
method
MethodInfoThe MethodInfo for the method that is mapped to the function.
Returns
- IMutableDbFunction
The removed IMutableDbFunction or null if the method is not mapped.
RemoveDbFunction(IMutableModel, string)
Removes the IMutableDbFunction that is mapped to the method represented by the given MethodInfo.
public static IMutableDbFunction RemoveDbFunction(this IMutableModel model, string name)
Parameters
model
IMutableModelThe model to find the function in.
name
stringThe model name of the function.
Returns
- IMutableDbFunction
The removed IMutableDbFunction or null if the method is not mapped.
RemoveSequence(IConventionModel, string, string)
Removes the IConventionSequence with the given name.
public static IConventionSequence RemoveSequence(this IConventionModel model, string name, string schema = null)
Parameters
model
IConventionModelThe model to find the sequence in.
name
stringThe sequence name.
schema
stringThe schema that contains the sequence.
Returns
- IConventionSequence
The removed IConventionSequence or null if no sequence with the given name in the given schema was found.
RemoveSequence(IMutableModel, string, string)
Removes the IMutableSequence with the given name.
public static IMutableSequence RemoveSequence(this IMutableModel model, string name, string schema = null)
Parameters
model
IMutableModelThe model to find the sequence in.
name
stringThe sequence name.
schema
stringThe schema that contains the sequence.
Returns
- IMutableSequence
The removed IMutableSequence or null if no sequence with the given name in the given schema was found.
SetCollation(IConventionModel, string, bool)
Sets the database collation.
public static string SetCollation(this IConventionModel model, string value, bool fromDataAnnotation = false)
Parameters
model
IConventionModelThe model to set the collation for.
value
stringThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured collation.
SetCollation(IMutableModel, string)
Sets the database collation.
public static void SetCollation(this IMutableModel model, string value)
Parameters
model
IMutableModelThe model to set the collation for.
value
stringThe value to set.
SetDefaultSchema(IConventionModel, string, bool)
Sets the default schema.
public static string SetDefaultSchema(this IConventionModel model, string value, bool fromDataAnnotation = false)
Parameters
model
IConventionModelThe model to set the default schema for.
value
stringThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured schema.
SetDefaultSchema(IMutableModel, string)
Sets the default schema.
public static void SetDefaultSchema(this IMutableModel model, string value)
Parameters
model
IMutableModelThe model to set the default schema for.
value
stringThe value to set.
SetMaxIdentifierLength(IConventionModel, int?, bool)
Sets the maximum length allowed for store identifiers.
public static int? SetMaxIdentifierLength(this IConventionModel model, int? length, bool fromDataAnnotation = false)
Parameters
model
IConventionModelThe model to set the default schema for.
length
int?The value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- int?
The configured value.
SetMaxIdentifierLength(IMutableModel, int?)
Sets the maximum length allowed for store identifiers.
public static void SetMaxIdentifierLength(this IMutableModel model, int? length)
Parameters
model
IMutableModelThe model to set the default schema for.
length
int?The value to set.
ToDebugString(IRelationalModel, MetadataDebugStringOptions, int)
Creates a human-readable representation of the given metadata.
Warning: Do not rely on the format of the returned string. It is designed for debugging only and may change arbitrarily between releases.
public static string ToDebugString(this IRelationalModel model, MetadataDebugStringOptions options, int indent = 0)
Parameters
model
IRelationalModelThe metadata item.
options
MetadataDebugStringOptionsOptions for generating the string.
indent
intThe number of indent spaces to use before each new line.
Returns
- string
A human-readable representation.