Beispiel #1
0
 /// <summary>
 /// Gets ConfigurationPropertyModelBuilder for property with multiple option
 /// Overides existing configuration from property
 /// </summary>
 /// <typeparam name="TModel">Source model type</typeparam>
 /// <typeparam name="TOption">Option type</typeparam>
 /// <typeparam name="TOptionCollection">Option Collection type</typeparam>
 /// <typeparam name="TConfigurationSet">ConfigurationSet to provide available options</typeparam>
 /// <param name="source">model with property</param>
 /// <param name="expression">property selector</param>
 /// <param name="optionProvider">Options Selector</param>
 /// <returns>ConfigurationPropertyWithOptionBuilder for selected property</returns>
 public static ConfigurationPropertyWithOptionBuilder PropertyWithMultipleOptions <TModel, TOption, TOptionCollection, TConfigurationSet>(this IModelWithProperties <TModel> source, Expression <Func <TModel, TOptionCollection> > expression, Expression <Func <TConfigurationSet, OptionSet <TOption> > > optionProvider) where TConfigurationSet : ConfigurationSet where TOption : new() where TOptionCollection : ICollection <TOption>
 {
     return(source.PropertyWithMultipleOptions(expression, ConfigurationSetOptionProvider.Create(optionProvider)));
 }
Beispiel #2
0
        /// <summary>
        /// Gets ConfigurationPropertyModelBuilder for property with multiple option
        /// Overides existing configuration from property
        /// </summary>
        /// <typeparam name = "TModel" > Source model type</typeparam>
        /// <typeparam name = "TOption" > Option type</typeparam>
        /// <typeparam name = "TValue" > Option value type</typeparam>
        /// <typeparam name = "TValueCollection" > Value Collection type</typeparam>
        /// <typeparam name = "TConfigurationSet" > ConfigurationSet to provide available options</typeparam>
        /// <param name = "source" > model with property</param>
        /// <param name = "expression" > property selector</param>
        /// <param name = "optionProvider" > Options Selector</param>
        /// <param name = "keySelector" > Option value selector</param>
        /// <returns>ConfigurationPropertyWithOptionBuilder for selected property</returns>
        public static ConfigurationPropertyWithOptionValueBuilder PropertyWithMultipleOptionValues <TModel, TOption, TValue, TValueCollection, TConfigurationSet>(this IModelWithProperties <TModel> source, Expression <Func <TModel, TValueCollection> > expression, Expression <Func <TConfigurationSet, OptionSet <TOption> > > optionProvider, Expression <Func <TOption, TValue> > keySelector) where TConfigurationSet : ConfigurationSet where TOption : new() where TValueCollection : ICollection <TValue>
        {
            var optionValueProvider = ConfigurationSetOptionProvider.Create(optionProvider, keySelector.Compile());

            return(source.PropertyWithMultipleOptionValues(expression, optionValueProvider));
        }