Example #1
0
        /// <summary>
        /// Fill the specified property with the result of the specified function
        /// </summary>
        /// <typeparam name="T1">The target object type</typeparam>
        /// <typeparam name="T2">The target property type</typeparam>
        /// <param name="expression">The target property</param>
        /// <param name="filler">A function that will return a property value</param>
        /// <returns>A configurator for the target object type</returns>
        public AngieConfigurator Fill <T1, T2>(Expression <Func <T1, T2> > expression, Func <T2> filler)
        {
            PropertyInfo      propertyInfo = (expression.Body as MemberExpression).Member as PropertyInfo;
            CustomFiller <T2> customFiller = new CustomFiller <T2>(propertyInfo.Name, typeof(T1), filler);

            _fillerManager.RegisterFiller(customFiller);
            return(this);
        }