/// <summary> /// 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. /// </summary> /// <param name="bindingInfo"> The binding information. </param> /// <returns> The expression tree. </returns> public override Expression BindToParameter(ParameterBindingInfo bindingInfo) { var property = ConsumedProperties[0]; return(Expression.Call(bindingInfo.MaterializationContextExpression, MaterializationContext.GetValueBufferMethod) .CreateValueBufferReadValueExpression(property.ClrType, bindingInfo.GetValueBufferIndex(property), property)); }
/// <summary> /// 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. /// </summary> /// <param name="bindingInfo"> The binding information. </param> /// <returns> The expression tree. </returns> public override Expression BindToParameter(ParameterBindingInfo bindingInfo) { var property = ConsumedProperties[0]; return(Expression.Call( EntityMaterializerSource.TryReadValueMethod.MakeGenericMethod(property.ClrType), Expression.Call(bindingInfo.MaterializationContextExpression, MaterializationContext.GetValueBufferMethod), Expression.Constant(bindingInfo.GetValueBufferIndex(property)), Expression.Constant(property, typeof(IPropertyBase)))); }