Example #1
0
        public static void GetAccessors(this ILotAttributes lotAttributes, IAttributeNameKey attribute, out Func <decimal?> get, out Func <decimal?, decimal?> set)
        {
            var attributeNameKey = new AttributeNameKey(attribute);

            get = () => AttributeGetters[attributeNameKey](lotAttributes);
            set = v => AttributeSetters[attributeNameKey](lotAttributes, v);
        }
Example #2
0
        public static Func <decimal?, decimal?> AttributeSet(this ILotAttributes lotAttributes, IAttributeNameKey attributeNameKey, bool rounded = false)
        {
            Func <ILotAttributes, decimal?, decimal?> setter;

            AttributeSetters.TryGetValue(new AttributeNameKey(attributeNameKey), out setter);
            if (setter == null)
            {
                return(null);
            }

            if (rounded)
            {
                return(v => setter(lotAttributes, Rounded(v, GetRoundDecimalPlaces(attributeNameKey))));
            }

            return(v => setter(lotAttributes, v));
        }