Class RelationalPropertyExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Property extension methods for relational database metadata.
public static class RelationalPropertyExtensions
- Inheritance
-
RelationalPropertyExtensions
- Inherited Members
Remarks
See Modeling entity types and relationships for more information and examples.
Methods
FindColumn(IProperty, in StoreObjectIdentifier)
Returns the column corresponding to this property if it's mapped to the given table-like store object.
public static IColumnBase? FindColumn(this IProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IColumnBase
The column to which the property is mapped.
FindOverrides(IConventionProperty, in StoreObjectIdentifier)
Returns the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IConventionRelationalPropertyOverrides? FindOverrides(this IConventionProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IConventionPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IConventionRelationalPropertyOverrides
An object that stores property facet overrides.
FindOverrides(IMutableProperty, in StoreObjectIdentifier)
Returns the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IMutableRelationalPropertyOverrides? FindOverrides(this IMutableProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IMutablePropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IMutableRelationalPropertyOverrides
An object that stores property facet overrides.
FindOverrides(IProperty, in StoreObjectIdentifier)
Returns the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IRelationalPropertyOverrides? FindOverrides(this IProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IRelationalPropertyOverrides
An object that stores property facet overrides.
FindOverrides(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IReadOnlyRelationalPropertyOverrides? FindOverrides(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IReadOnlyRelationalPropertyOverrides
An object that stores property facet overrides.
FindRelationalTypeMapping(IReadOnlyProperty)
Returns the RelationalTypeMapping for the given property on a finalized model.
public static RelationalTypeMapping? FindRelationalTypeMapping(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- RelationalTypeMapping
The type mapping, or null if none was found.
FindRelationalTypeMapping(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the RelationalTypeMapping for the given property on a finalized model.
public static RelationalTypeMapping? FindRelationalTypeMapping(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- RelationalTypeMapping
The type mapping, or null if none was found.
FindSharedStoreObjectRootProperty(IConventionProperty, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.IProperty that is mapped to the same column in a shared table-like object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IConventionProperty? FindSharedStoreObjectRootProperty(this IConventionProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IConventionPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IConventionProperty
The property found, or null if none was found.
FindSharedStoreObjectRootProperty(IMutableProperty, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.IProperty that is mapped to the same column in a shared table-like object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IMutableProperty? FindSharedStoreObjectRootProperty(this IMutableProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IMutablePropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IMutableProperty
The property found, or null if none was found.
FindSharedStoreObjectRootProperty(IProperty, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.IProperty that is mapped to the same column in a shared table-like object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IProperty? FindSharedStoreObjectRootProperty(this IProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IProperty
The property found, or null if none was found.
FindSharedStoreObjectRootProperty(IReadOnlyProperty, in StoreObjectIdentifier)
Finds the first Microsoft.EntityFrameworkCore.Metadata.IProperty that is mapped to the same column in a shared table-like object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IReadOnlyProperty? FindSharedStoreObjectRootProperty(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IReadOnlyProperty
The property found, or null if none was found.
GetCollation(IReadOnlyProperty)
Returns the collation to be used for the column.
public static string? GetCollation(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The collation for the column this property is mapped to.
GetCollation(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the collation to be used for the column.
public static string? GetCollation(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The collation for the column this property is mapped to.
GetCollationConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column collation.
public static ConfigurationSource? GetCollationConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column collation.
GetColumnBaseName(IReadOnlyProperty)
Returns the base name of the column to which the property would be mapped.
[Obsolete("Use GetColumnName")]
public static string GetColumnBaseName(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The base name of the column to which the property would be mapped.
GetColumnName(IReadOnlyProperty)
Returns the name of the column to which the property would be mapped.
public static string GetColumnName(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The base name of the column to which the property would be mapped.
GetColumnName(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the name of the column to which the property is mapped for a particular table.
public static string? GetColumnName(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The name of the column to which the property is mapped.
GetColumnNameConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column name.
public static ConfigurationSource? GetColumnNameConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column name.
GetColumnNameConfigurationSource(IConventionProperty, in StoreObjectIdentifier)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column name for a particular table-like store object.
public static ConfigurationSource? GetColumnNameConfigurationSource(this IConventionProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IConventionPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column name for a particular table-like store object.
GetColumnOrder(IReadOnlyProperty)
Returns the order of the column this property is mapped to.
public static int? GetColumnOrder(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- int?
The column order.
GetColumnOrder(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the order of the column this property is mapped to for a particular table.
public static int? GetColumnOrder(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- int?
The column order.
GetColumnOrderConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource of the column order.
public static ConfigurationSource? GetColumnOrderConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource.
GetColumnType(IProperty)
Returns the database type of the column to which the property is mapped.
public static string GetColumnType(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- string
The database type of the column to which the property is mapped.
GetColumnType(IProperty, in StoreObjectIdentifier)
Returns the database type of the column to which the property is mapped.
public static string GetColumnType(this IProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The database type of the column to which the property is mapped.
GetColumnType(IReadOnlyProperty)
Returns the database type of the column to which the property is mapped, or null if the database type could not be found.
public static string? GetColumnType(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The database type of the column to which the property is mapped, or null if the database type could not be found.
GetColumnType(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the database type of the column to which the property is mapped, or null if the database type could not be found.
public static string? GetColumnType(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The database type of the column to which the property is mapped, or null if the database type could not be found.
GetColumnTypeConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column name.
public static ConfigurationSource? GetColumnTypeConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column name.
GetComment(IReadOnlyProperty)
Returns the comment for the column this property is mapped to.
public static string? GetComment(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The comment for the column this property is mapped to.
GetComment(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the comment for the column this property is mapped to.
public static string? GetComment(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The comment for the column this property is mapped to.
GetCommentConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column comment.
public static ConfigurationSource? GetCommentConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the column comment.
GetComputedColumnSql(IReadOnlyProperty)
Returns the SQL expression that is used as the computed value for the column this property is mapped to.
public static string? GetComputedColumnSql(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The SQL expression that is used as the computed value for the column this property is mapped to.
GetComputedColumnSql(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the SQL expression that is used as the computed value for the column this property is mapped to.
public static string? GetComputedColumnSql(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The SQL expression that is used as the computed value for the column this property is mapped to.
GetComputedColumnSqlConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the computed value SQL expression.
public static ConfigurationSource? GetComputedColumnSqlConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the computed value SQL expression.
GetDefaultColumnBaseName(IReadOnlyProperty)
Returns the default base name of the column to which the property would be mapped
[Obsolete("Use GetDefaultColumnName")]
public static string GetDefaultColumnBaseName(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The default base column name to which the property would be mapped.
GetDefaultColumnMappings(IProperty)
Returns the default columns to which the property would be mapped.
public static IEnumerable<IColumnMappingBase> GetDefaultColumnMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IColumnMappingBase>
The default columns to which the property would be mapped.
GetDefaultColumnName(IReadOnlyProperty)
Returns the default base name of the column to which the property would be mapped
public static string GetDefaultColumnName(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The default base column name to which the property would be mapped.
GetDefaultColumnName(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the default column name to which the property would be mapped.
public static string? GetDefaultColumnName(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The default column name to which the property would be mapped.
GetDefaultValue(IReadOnlyProperty)
Returns the object that is used as the default value for the column this property is mapped to.
public static object? GetDefaultValue(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- object
The object that is used as the default value for the column this property is mapped to.
GetDefaultValue(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the object that is used as the default value for the column this property is mapped to.
public static object? GetDefaultValue(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- object
The object that is used as the default value for the column this property is mapped to.
GetDefaultValueConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the default value.
public static ConfigurationSource? GetDefaultValueConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the default value.
GetDefaultValueSql(IReadOnlyProperty)
Returns the SQL expression that is used as the default value for the column this property is mapped to.
public static string? GetDefaultValueSql(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The SQL expression that is used as the default value for the column this property is mapped to.
GetDefaultValueSql(IReadOnlyProperty, in StoreObjectIdentifier)
Returns the SQL expression that is used as the default value for the column this property is mapped to.
public static string? GetDefaultValueSql(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- string
The SQL expression that is used as the default value for the column this property is mapped to.
GetDefaultValueSqlConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the default value SQL expression.
public static ConfigurationSource? GetDefaultValueSqlConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the default value SQL expression.
GetDeleteStoredProcedureParameterMappings(IProperty)
Returns the delete stored procedure parameters to which the property is mapped.
public static IEnumerable<IStoredProcedureParameterMapping> GetDeleteStoredProcedureParameterMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IStoredProcedureParameterMapping>
The delete stored procedure parameters to which the property is mapped.
GetFunctionColumnMappings(IProperty)
Returns the function columns to which the property is mapped.
public static IEnumerable<IFunctionColumnMapping> GetFunctionColumnMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IFunctionColumnMapping>
The function columns to which the property is mapped.
GetInsertStoredProcedureParameterMappings(IProperty)
Returns the insert stored procedure parameters to which the property is mapped.
public static IEnumerable<IStoredProcedureParameterMapping> GetInsertStoredProcedureParameterMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IStoredProcedureParameterMapping>
The insert stored procedure parameters to which the property is mapped.
GetInsertStoredProcedureResultColumnMappings(IProperty)
Returns the insert stored procedure result columns to which the property is mapped.
public static IEnumerable<IStoredProcedureResultColumnMapping> GetInsertStoredProcedureResultColumnMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IStoredProcedureResultColumnMapping>
The insert stored procedure result columns to which the property is mapped.
GetIsFixedLengthConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for IsFixedLength(IReadOnlyProperty).
public static ConfigurationSource? GetIsFixedLengthConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for IsFixedLength(IReadOnlyProperty).
GetIsStored(IReadOnlyProperty)
Gets whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.
public static bool? GetIsStored(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- bool?
Whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.
GetIsStored(IReadOnlyProperty, in StoreObjectIdentifier)
Gets whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.
public static bool? GetIsStored(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- bool?
Whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.
GetIsStoredConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the computed value SQL expression.
public static ConfigurationSource? GetIsStoredConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the computed value SQL expression.
GetJsonPropertyName(IReadOnlyProperty)
Gets the value of JSON property name used for the given property of an entity mapped to a JSON column.
public static string? GetJsonPropertyName(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- string
The value for the JSON property used to store the value of this entity property. null is returned for key properties and for properties of entities that are not mapped to a JSON column.
Remarks
Unless configured explicitly, entity property name is used.
GetJsonPropertyNameConfigurationSource(IConventionProperty)
Gets the Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the JSON property name for a given entity property.
public static ConfigurationSource? GetJsonPropertyNameConfigurationSource(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- ConfigurationSource?
The Microsoft.EntityFrameworkCore.Metadata.ConfigurationSource for the JSON property name for a given entity property.
GetMappedStoreObjects(IReadOnlyProperty, StoreObjectType)
Returns the table-like store objects to which this property is mapped.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IEnumerable<StoreObjectIdentifier> GetMappedStoreObjects(this IReadOnlyProperty property, StoreObjectType storeObjectType)
Parameters
property
IReadOnlyPropertyThe property.
storeObjectType
StoreObjectTypeThe type of the store object.
Returns
- IEnumerable<StoreObjectIdentifier>
The table-like store objects to which this property is mapped.
GetMaxLength(IReadOnlyProperty, in StoreObjectIdentifier)
Gets the maximum length of data that is allowed in this property. For example, if the property is a string then this is the maximum number of characters.
public static int? GetMaxLength(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
GetOrCreateOverrides(IConventionProperty, in StoreObjectIdentifier, bool)
Returns the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IConventionRelationalPropertyOverrides GetOrCreateOverrides(this IConventionProperty property, in StoreObjectIdentifier storeObject, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionRelationalPropertyOverrides
An object that stores property facet overrides.
GetOrCreateOverrides(IMutableProperty, in StoreObjectIdentifier)
Returns the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IMutableRelationalPropertyOverrides GetOrCreateOverrides(this IMutableProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IMutablePropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- IMutableRelationalPropertyOverrides
An object that stores property facet overrides.
GetOverrides(IConventionProperty)
Returns all the property facet overrides.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IEnumerable<IConventionRelationalPropertyOverrides> GetOverrides(this IConventionProperty property)
Parameters
property
IConventionPropertyThe property.
Returns
- IEnumerable<IConventionRelationalPropertyOverrides>
The property facet overrides.
GetOverrides(IMutableProperty)
Returns all the property facet overrides.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IEnumerable<IMutableRelationalPropertyOverrides> GetOverrides(this IMutableProperty property)
Parameters
property
IMutablePropertyThe property.
Returns
- IEnumerable<IMutableRelationalPropertyOverrides>
The property facet overrides.
GetOverrides(IProperty)
Returns all the property facet overrides.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IEnumerable<IRelationalPropertyOverrides> GetOverrides(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IRelationalPropertyOverrides>
The property facet overrides.
GetOverrides(IReadOnlyProperty)
Returns all the property facet overrides.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IEnumerable<IReadOnlyRelationalPropertyOverrides> GetOverrides(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- IEnumerable<IReadOnlyRelationalPropertyOverrides>
The property facet overrides.
GetPrecision(IReadOnlyProperty, in StoreObjectIdentifier)
Gets the precision of data that is allowed in this property. For example, if the property is a decimal then this is the maximum number of digits.
public static int? GetPrecision(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
GetReaderFieldValue(IProperty, RelationalDataReader, int, bool)
Reads a value for this property from the given relationalReader
.
public static object? GetReaderFieldValue(this IProperty property, RelationalDataReader relationalReader, int ordinal, bool detailedErrorsEnabled)
Parameters
property
IPropertyThe property.
relationalReader
RelationalDataReaderThe read from which to read the property's value.
ordinal
intThe ordinal to read in the
relationalReader
.detailedErrorsEnabled
boolWhether detailed errors should be logged.
Returns
GetRelationalTypeMapping(IReadOnlyProperty)
Returns the RelationalTypeMapping for the given property on a finalized model.
public static RelationalTypeMapping GetRelationalTypeMapping(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- RelationalTypeMapping
The type mapping.
GetScale(IReadOnlyProperty, in StoreObjectIdentifier)
Gets the scale of data that is allowed in this property. For example, if the property is a decimal then this is the maximum number of decimal places.
public static int? GetScale(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
GetSqlQueryColumnMappings(IProperty)
Returns the SQL query columns to which the property is mapped.
public static IEnumerable<ISqlQueryColumnMapping> GetSqlQueryColumnMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<ISqlQueryColumnMapping>
The SQL query columns to which the property is mapped.
GetTableColumnMappings(IProperty)
Returns the table columns to which the property is mapped.
public static IEnumerable<IColumnMapping> GetTableColumnMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IColumnMapping>
The table columns to which the property is mapped.
GetUpdateStoredProcedureParameterMappings(IProperty)
Returns the update stored procedure parameters to which the property is mapped.
public static IEnumerable<IStoredProcedureParameterMapping> GetUpdateStoredProcedureParameterMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IStoredProcedureParameterMapping>
The update stored procedure parameters to which the property is mapped.
GetUpdateStoredProcedureResultColumnMappings(IProperty)
Returns the update stored procedure result columns to which the property is mapped.
public static IEnumerable<IStoredProcedureResultColumnMapping> GetUpdateStoredProcedureResultColumnMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IStoredProcedureResultColumnMapping>
The update stored procedure result columns to which the property is mapped.
GetViewColumnMappings(IProperty)
Returns the view columns to which the property is mapped.
public static IEnumerable<IViewColumnMapping> GetViewColumnMappings(this IProperty property)
Parameters
property
IPropertyThe property.
Returns
- IEnumerable<IViewColumnMapping>
The view columns to which the property is mapped.
IsColumnNullable(IReadOnlyProperty)
Checks whether the column mapped to the given Microsoft.EntityFrameworkCore.Metadata.IProperty will be nullable when created in the database.
public static bool IsColumnNullable(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty.
Returns
Remarks
This depends on the property itself and also how it is mapped. For example, derived non-nullable properties in a TPH type hierarchy will be mapped to nullable columns. As well as properties on optional types sharing the same table.
IsColumnNullable(IReadOnlyProperty, in StoreObjectIdentifier)
Checks whether the column mapped to the given property will be nullable when created in the database.
public static bool IsColumnNullable(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
Remarks
This depends on the property itself and also how it is mapped. For example, derived non-nullable properties in a TPH type hierarchy will be mapped to nullable columns. As well as properties on optional types sharing the same table.
IsFixedLength(IReadOnlyProperty)
Returns a flag indicating whether the property is capable of storing only fixed-length data, such as strings.
public static bool? IsFixedLength(this IReadOnlyProperty property)
Parameters
property
IReadOnlyPropertyThe property.
Returns
- bool?
A flag indicating whether the property is capable of storing only fixed-length data, such as strings.
IsFixedLength(IReadOnlyProperty, in StoreObjectIdentifier)
Returns a flag indicating whether the property is capable of storing only fixed-length data, such as strings.
public static bool? IsFixedLength(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
- bool?
A flag indicating whether the property is capable of storing only fixed-length data, such as strings.
IsUnicode(IReadOnlyProperty, in StoreObjectIdentifier)
Gets a value indicating whether or not the property can persist Unicode characters.
public static bool? IsUnicode(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
Returns
RemoveOverrides(IConventionProperty, in StoreObjectIdentifier)
Removes the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IConventionRelationalPropertyOverrides? RemoveOverrides(this IConventionProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IConventionPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of a table-like store object.
Returns
- IConventionRelationalPropertyOverrides
The removed IConventionRelationalPropertyOverrides or null if no overrides for the given store object were found or the existing overrides were configured from a higher source.
RemoveOverrides(IMutableProperty, in StoreObjectIdentifier)
Removes the property facet overrides for a particular table-like store object.
This method is typically used by database providers (and other extensions). It is generally not used in application code.
public static IMutableRelationalPropertyOverrides? RemoveOverrides(this IMutableProperty property, in StoreObjectIdentifier storeObject)
Parameters
property
IMutablePropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of a table-like store object.
Returns
- IMutableRelationalPropertyOverrides
The removed IMutableRelationalPropertyOverrides or null if no overrides for the given store object were found.
SetCollation(IConventionProperty, string?, bool)
Configures a collation to be used for the column this property is mapped to.
public static string? SetCollation(this IConventionProperty property, string? collation, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
collation
stringThe collation for the column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetCollation(IMutableProperty, string?)
Configures a collation to be used for column this property is mapped to.
public static void SetCollation(this IMutableProperty property, string? collation)
Parameters
property
IMutablePropertyThe property.
collation
stringThe collation for the column.
SetColumnName(IConventionProperty, string?, in StoreObjectIdentifier, bool)
Sets the column to which the property is mapped for a particular table-like store object.
public static string? SetColumnName(this IConventionProperty property, string? name, in StoreObjectIdentifier storeObject, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
name
stringThe name to set.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetColumnName(IConventionProperty, string?, bool)
Sets the column to which the property is mapped.
public static string? SetColumnName(this IConventionProperty property, string? name, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
name
stringThe name to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetColumnName(IMutableProperty, string?)
Sets the column to which the property is mapped.
public static void SetColumnName(this IMutableProperty property, string? name)
Parameters
property
IMutablePropertyThe property.
name
stringThe name to set.
SetColumnName(IMutableProperty, string?, in StoreObjectIdentifier)
Sets the column to which the property is mapped for a particular table-like store object.
public static void SetColumnName(this IMutableProperty property, string? name, in StoreObjectIdentifier storeObject)
Parameters
property
IMutablePropertyThe property.
name
stringThe name to set.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
SetColumnOrder(IConventionProperty, int?, bool)
Sets the order of the column the property is mapped to.
public static int? SetColumnOrder(this IConventionProperty property, int? order, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
order
int?The column order.
fromDataAnnotation
boolA value indicating whether the configuration was specified using a data annotation.
Returns
- int?
The configured value.
SetColumnOrder(IMutableProperty, int?)
Sets the order of the column the property is mapped to.
public static void SetColumnOrder(this IMutableProperty property, int? order)
Parameters
property
IMutablePropertyThe property.
order
int?The column order.
SetColumnType(IConventionProperty, string?, bool)
Sets the database type of the column to which the property is mapped.
public static string? SetColumnType(this IConventionProperty property, string? value, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
value
stringThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetColumnType(IMutableProperty, string?)
Sets the database type of the column to which the property is mapped.
public static void SetColumnType(this IMutableProperty property, string? value)
Parameters
property
IMutablePropertyThe property.
value
stringThe value to set.
SetComment(IConventionProperty, string?, bool)
Configures a comment to be applied to the column this property is mapped to.
public static string? SetComment(this IConventionProperty property, string? comment, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
comment
stringThe comment for the column.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetComment(IMutableProperty, string?)
Configures a comment to be applied to the column this property is mapped to.
public static void SetComment(this IMutableProperty property, string? comment)
Parameters
property
IMutablePropertyThe property.
comment
stringThe comment for the column.
SetComputedColumnSql(IConventionProperty, string?, bool)
Sets the SQL expression that is used as the computed value for the column this property is mapped to.
public static string? SetComputedColumnSql(this IConventionProperty property, string? value, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
value
stringThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetComputedColumnSql(IMutableProperty, string?)
Sets the SQL expression that is used as the computed value for the column this property is mapped to.
public static void SetComputedColumnSql(this IMutableProperty property, string? value)
Parameters
property
IMutablePropertyThe property.
value
stringThe value to set.
SetDefaultValue(IConventionProperty, object?, bool)
Sets the object that is used as the default value for the column this property is mapped to.
public static object? SetDefaultValue(this IConventionProperty property, object? value, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
value
objectThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- object
The configured value.
SetDefaultValue(IMutableProperty, object?)
Sets the object that is used as the default value for the column this property is mapped to.
public static void SetDefaultValue(this IMutableProperty property, object? value)
Parameters
property
IMutablePropertyThe property.
value
objectThe value to set.
SetDefaultValueSql(IConventionProperty, string?, bool)
Sets the SQL expression that is used as the default value for the column this property is mapped to.
public static string? SetDefaultValueSql(this IConventionProperty property, string? value, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
value
stringThe value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetDefaultValueSql(IMutableProperty, string?)
Sets the SQL expression that is used as the default value for the column this property is mapped to.
public static void SetDefaultValueSql(this IMutableProperty property, string? value)
Parameters
property
IMutablePropertyThe property.
value
stringThe value to set.
SetIsFixedLength(IConventionProperty, bool?, bool)
Sets a flag indicating whether the property is capable of storing only fixed-length data, such as strings.
public static bool? SetIsFixedLength(this IConventionProperty property, bool? fixedLength, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
fixedLength
bool?A value indicating whether the property is constrained to fixed length values.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool?
The configured value.
SetIsFixedLength(IMutableProperty, bool?)
Sets a flag indicating whether the property is capable of storing only fixed-length data, such as strings.
public static void SetIsFixedLength(this IMutableProperty property, bool? fixedLength)
Parameters
property
IMutablePropertyThe property.
fixedLength
bool?A value indicating whether the property is constrained to fixed length values.
SetIsStored(IConventionProperty, bool?, bool)
Sets whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.
public static bool? SetIsStored(this IConventionProperty property, bool? value, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
value
bool?The value to set.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- bool?
The configured value.
SetIsStored(IMutableProperty, bool?)
Sets whether the value of the computed column this property is mapped to is stored in the database, or calculated when it is read.
public static void SetIsStored(this IMutableProperty property, bool? value)
Parameters
property
IMutablePropertyThe property.
value
bool?The value to set.
SetJsonPropertyName(IConventionProperty, string?, bool)
Sets the value of JSON property name used for the given property of an entity mapped to a JSON column.
public static string? SetJsonPropertyName(this IConventionProperty property, string? name, bool fromDataAnnotation = false)
Parameters
property
IConventionPropertyThe property.
name
stringThe name to be used.
fromDataAnnotation
boolIndicates whether the configuration was specified using a data annotation.
Returns
- string
The configured value.
SetJsonPropertyName(IMutableProperty, string?)
Sets the value of JSON property name used for the given property of an entity mapped to a JSON column.
public static void SetJsonPropertyName(this IMutableProperty property, string? name)
Parameters
property
IMutablePropertyThe property.
name
stringThe name to be used.
TryGetDefaultValue(IReadOnlyProperty, in StoreObjectIdentifier, out object?)
Returns the object that is used as the default value for the column this property is mapped to.
public static bool TryGetDefaultValue(this IReadOnlyProperty property, in StoreObjectIdentifier storeObject, out object? defaultValue)
Parameters
property
IReadOnlyPropertyThe property.
storeObject
StoreObjectIdentifierThe identifier of the table-like store object containing the column.
defaultValue
objectThe default value, or the CLR default if no explicit default has been set.
Returns
TryGetDefaultValue(IReadOnlyProperty, out object?)
Returns the object that is used as the default value for the column this property is mapped to.
public static bool TryGetDefaultValue(this IReadOnlyProperty property, out object? defaultValue)
Parameters
property
IReadOnlyPropertyThe property.
defaultValue
objectThe default value, or the CLR default if no explicit default has been set.