Table of Contents

Class DependencyInjectionMethodParameterBinding

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

Describes the binding from a method on 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 DependencyInjectionMethodParameterBinding : DependencyInjectionParameterBinding
Inheritance
DependencyInjectionMethodParameterBinding
Inherited Members

Remarks

See Entity types with constructors for more information and examples.

Constructors

DependencyInjectionMethodParameterBinding(Type, Type, MethodInfo, params IPropertyBase[]?)

Creates a new DependencyInjectionParameterBinding instance for the given method of the given service type.

public DependencyInjectionMethodParameterBinding(Type parameterType, Type serviceType, MethodInfo method, params IPropertyBase[]? serviceProperties)

Parameters

parameterType Type

The parameter CLR type.

serviceType Type

The service CLR types, as resolved from dependency injection

method MethodInfo

The method of the service to bind to.

serviceProperties IPropertyBase[]

The associated IServiceProperty objects, or null.

Properties

Method

The method being bound to, as defined on the dependency injection service interface.

public virtual MethodInfo Method { get; }

Property Value

MethodInfo

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(ParameterBindingInfo)

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(ParameterBindingInfo bindingInfo)

Parameters

bindingInfo ParameterBindingInfo

The binding information.

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.