Show / Hide Table of Contents

Class EntityFrameworkSeltzrOptionsBuilderExtensions

Extension methods for the SeltzrOptionsBuilder<TModel, TUser> class specific to Entity Framework

Inheritance
Object
EntityFrameworkSeltzrOptionsBuilderExtensions
Namespace: Seltzr.Extensions
Assembly: Seltzr.EntityFramework.dll
Syntax
C#
public static class EntityFrameworkSeltzrOptionsBuilderExtensions

Methods

| Improve this Doc View Source

EagerLoad<TModel, TUser>(SeltzrOptionsBuilder<TModel, TUser>, Expression<Func<TModel, Object>>[])

Eagerly loads the given properties before returning the model

C#
public static SeltzrOptionsBuilder<TModel, TUser> EagerLoad<TModel, TUser>(this SeltzrOptionsBuilder<TModel, TUser> builder, params Expression<Func<TModel, object>>[] properties)
    where TModel : class where TUser : class
Parameters
builderSeltzrOptionsBuilder<TModel, TUser>

The options builder to perform the operation on

propertiesExpression<Func<TModel, Object>>[]

The properties to eagerly load

Returns

SeltzrOptionsBuilder<TModel, TUser>

This SeltzrOptionsBuilder<TModel, TUser> object, for chaining

Type Parameters
TModel

The model type that the API is being built for

TUser

The type of authenticated user context

Remarks

This method internally calls Entity Framework's Include method. Therefore, calls to select and child properties are supported.

Examples

Include navigation properties in the API response:

C#
options.EagerLoad(e => e.Project, e => e.Profile);

Include all projects and tasks in the API response:

C#
// Either
options.EagerLoad(e => e.Project.Tasks);
// Or
options.EagerLoad(e => e.Project.Select(p => p.Tasks));
  • Improve this Doc
  • View Source
Back to top Generated by DocFX