/// <summary> /// Sets the list builder for the specified property. Use this to assign a <see cref="FluentBuilder{IList{TPropertyType}}"/> to build the list for the property whose type is IList{PropertyType}. /// </summary> /// <typeparam name="TPropertyType">The type of the property type.</typeparam> /// <param name="propertyExpression">The property expression.</param> /// <param name="builder">The builder.</param> /// <exception cref="ArgumentException">Invalid builder type. Builder type must be a FluentListBuilder of the Property Type</exception> /// <exception cref="ArgumentException">PropertyType must derive from IList</exception> protected internal FluentBuilder<T> SetList<TPropertyType>(Expression<Func<T, TPropertyType>> propertyExpression, IFluentBuilder builder) where TPropertyType : class { if (!IsListType(typeof(TPropertyType))) throw new ArgumentException("PropertyType must derive from IList"); // Due to lack of polymorphism in generic parameters. if (!(builder is IFluentBuilder<TPropertyType>)) { throw new ArgumentException( "Invalid builder type. Builder type must be a FluentListBuilder of Property Type. \n BuilderType='{0}'\n PropertyType='{1}'".format_using(builder.GetType().FullName, typeof(TPropertyType).FullName)); } AddBuilderFor(propertyExpression, builder); return this; }