Table of Contents

Class MaybeEntityTypeBuilderExtensions

Namespace
Trellis.EntityFrameworkCore
Assembly
Trellis.EntityFrameworkCore.dll

Entity type builder helpers that resolve Maybe<T> properties to their mapped storage members.

public static class MaybeEntityTypeBuilderExtensions
Inheritance
MaybeEntityTypeBuilderExtensions
Inherited Members

Methods

HasTrellisIndex<TEntity>(EntityTypeBuilder<TEntity>, Expression<Func<TEntity, object?>>)

Creates an index using CLR property selectors while automatically translating any Maybe<T> properties to their field-only EF Core mappings.

public static IndexBuilder<TEntity> HasTrellisIndex<TEntity>(this EntityTypeBuilder<TEntity> entityTypeBuilder, Expression<Func<TEntity, object?>> propertySelector) where TEntity : class

Parameters

entityTypeBuilder EntityTypeBuilder<TEntity>

The entity type builder.

propertySelector Expression<Func<TEntity, object>>

A single property selector or anonymous object of property selectors. Example: e => e.Phone or e => new { e.Status, e.SubmittedAt }.

Returns

IndexBuilder<TEntity>

The index builder for additional configuration.

Type Parameters

TEntity

The entity type.

Exceptions

InvalidOperationException

Thrown when a Maybe<T> selector resolves to a storage member that neither exists on the CLR type nor is already mapped in the EF model.