Table of Contents

Class ServiceParameterBinding

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

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

public abstract class ServiceParameterBinding : ParameterBinding
Inheritance
ServiceParameterBinding
Derived
Inherited Members

Remarks

See Entity types with constructors for more information and examples.

Constructors

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

Creates a new ServiceParameterBinding instance for the given service type or metadata type.

protected ServiceParameterBinding(Type parameterType, Type serviceType, params IPropertyBase[]? serviceProperties)

Parameters

parameterType Type

The parameter CLR type.

serviceType Type

The service or metadata CLR type.

serviceProperties IPropertyBase[]

The associated IServiceProperty instances, or null.

Properties

ServiceDelegate

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

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

Property Value

Func<MaterializationContext, IEntityType, object, object>

ServiceType

The EF internal service CLR type.

public virtual Type ServiceType { get; }

Property Value

Type

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.

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 abstract 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.