public PropertyAccessor(PropertyInfo propertyInfo) : base(propertyInfo) { var HasSetter = propertyInfo.GetSetMethod(true) != null; _lateBoundPropertySetExpression = HasSetter ? new Lazy <Expression <LateBoundPropertySet <TSource, TValue> > >(() => DelegateFactory.CreateSet <TSource, TValue>(propertyInfo)) : new Lazy <Expression <LateBoundPropertySet <TSource, TValue> > >(() => Expression.Lambda <LateBoundPropertySet <TSource, TValue> >(Expression.Empty(), Expression.Parameter(typeof(TSource)), Expression.Parameter(typeof(TValue)))); _lateBoundPropertySet = new Lazy <LateBoundPropertySet <TSource, TValue> >(() => _lateBoundPropertySetExpression.Value.Compile()); }
public FieldAccessor(FieldInfo fieldInfo) : base(fieldInfo) { _lateBoundFieldSetExpression = new Lazy <Expression <LateBoundFieldSet <TSource, TValue> > >(() => DelegateFactory.CreateSet <TSource, TValue>(fieldInfo)); _lateBoundFieldSet = new Lazy <LateBoundFieldSet <TSource, TValue> >(() => _lateBoundFieldSetExpression.Value.Compile()); }