Table of Contents

Class DependencyInjectionParameterBinding

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.dll

Describes the binding from an EF internal dependency injection service, which may or may not also have and associated IServiceProperty, to a parameter in a constructor, factory method, or similar.

public class DependencyInjectionParameterBinding : ServiceParameterBinding
Inheritance
DependencyInjectionParameterBinding
Derived
Inherited Members

Remarks

See Entity types with constructors for more information and examples.

Constructors

DependencyInjectionParameterBinding(Type, Type, params IPropertyBase[]?)

Creates a new DependencyInjectionParameterBinding instance for the given service type.

public DependencyInjectionParameterBinding(Type parameterType, Type serviceType, params IPropertyBase[]? serviceProperties)

Parameters

parameterType Type

The parameter CLR type.

serviceType Type

The service CLR types, as resolved from dependency injection

serviceProperties IPropertyBase[]

The associated IServiceProperty objects, or null.

Properties

ServiceDelegate

A delegate to set a CLR service property on an entity instance.

public override Func<MaterializationContext, IEntityType, object, object?> ServiceDelegate { get; }

Property Value

Func<MaterializationContext, IEntityType, object, object>

Methods

BindToParameter(Expression, Expression)

Creates an expression tree representing the binding of the value of a property from a materialization expression to a parameter of the constructor, factory method, etc.

public override Expression BindToParameter(Expression materializationExpression, Expression bindingInfoExpression)

Parameters

materializationExpression Expression

The expression representing the materialization context.

bindingInfoExpression Expression

The expression representing the ParameterBindingInfo constant.

Returns

Expression

The expression tree.

With(IPropertyBase[])

Creates a copy that contains the given consumed properties.

public override ParameterBinding With(IPropertyBase[] consumedProperties)

Parameters

consumedProperties IPropertyBase[]

The new consumed properties.

Returns

ParameterBinding

A copy with replaced consumed properties.