Class PropertyBuilderExtensions
Extension methods for configuration of properties that is aware of database vendor differences.
Inherited Members
Namespace: IRM.EntityFrameworkCore
Assembly: IRM.EntityFrameworkCore.dll
Syntax
public static class PropertyBuilderExtensions
Methods
HasJsonColumnType<T>(PropertyBuilder<T>, DbContext)
Configures the data type to Json of the column that the property maps to when targeting a relational database.
Declaration
public static PropertyBuilder<T> HasJsonColumnType<T>(this PropertyBuilder<T> builder, DbContext context)
Parameters
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<T>
builder
The builder for the property being configured. |
Microsoft.EntityFrameworkCore.DbContext
context
The Microsoft.EntityFrameworkCore.DbContext that the |
Returns
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<T>
The same builder instance so that multiple calls can be chained. |
Type Parameters
T
|
WithNewIdAsDefaultValue(PropertyBuilder<Guid>, DbContext)
Adds a default new id as value for a System.Guid column in the database, if the database supports it.
Declaration
public static PropertyBuilder<Guid> WithNewIdAsDefaultValue(this PropertyBuilder<Guid> builder, DbContext context)
Parameters
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<System.Guid>
builder
The builder used for configuration of the property. |
Microsoft.EntityFrameworkCore.DbContext
context
The Microsoft.EntityFrameworkCore.DbContext that the |
Returns
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<System.Guid>
The builder used for configuration of the property. |
WithNowAsDefaultValue(PropertyBuilder<DateTime>, DbContext, Boolean)
Adds a default now date as value for a System.DateTime column in the database, if the database supports it.
Declaration
public static PropertyBuilder<DateTime> WithNowAsDefaultValue(this PropertyBuilder<DateTime> builder, DbContext context, bool utc = false)
Parameters
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<System.DateTime>
builder
The builder used for configuration of the property. |
Microsoft.EntityFrameworkCore.DbContext
context
The Microsoft.EntityFrameworkCore.DbContext that the |
Boolean
utc
true to set the value in UTC time; otherwise false. |
Returns
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<System.DateTime>
The builder used for configuration of the property. |
WithNowAsDefaultValue(PropertyBuilder<DateTimeOffset>, DbContext, Boolean)
Adds a default now date as value for a System.DateTimeOffset column in the database, if the database supports it.
Declaration
public static PropertyBuilder<DateTimeOffset> WithNowAsDefaultValue(this PropertyBuilder<DateTimeOffset> builder, DbContext context, bool utc = false)
Parameters
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<System.DateTimeOffset>
builder
The builder used for configuration of the property. |
Microsoft.EntityFrameworkCore.DbContext
context
The Microsoft.EntityFrameworkCore.DbContext that the |
Boolean
utc
true to set the value in UTC time; otherwise false. |
Returns
Microsoft.EntityFrameworkCore.Metadata.Builders.PropertyBuilder<System.DateTimeOffset>
The builder used for configuration of the property. |