Exemple #1
0
        /// <summary>
        ///     Gets the setter and getter from the expression specified.
        /// </summary>
        /// <param name="propertyLambda">
        ///     The property lambda.
        /// </param>
        /// <param name="getter">
        ///     Receives the getter function.
        /// </param>
        /// <param name="setter">
        ///     Receives the setter method.
        /// </param>
        private static void FromExpression(Expression <Func <T, string> > propertyLambda, out Func <T, string> getter,
                                           out Action <T, string> setter)
        {
            var member    = (MemberExpression)propertyLambda.Body;
            var inspector = Inspector.InspectorForType(member.Member.DeclaringType);
            var property  = inspector.Properties.FirstOrDefault(p => p.Member == member.Member);

            if (property != null)
            {
                property.Ignore = true;
            }

            DelegateFactory.CreateAccessors(propertyLambda, out getter, out setter);
        }