This repository was archived by the owner on Dec 18, 2018. It is now read-only.
This repository was archived by the owner on Dec 18, 2018. It is now read-only.
Support for Uri in OptionsModel #260
Closed
Description
Old-style System.Configuration.ConfigurationSection
s support this, so ideally OptionsModel should too.
Example:
public class SiteSettings
{
public Uri FeedUrl { get; set; }
}
Results in:
Exception thrown: 'System.InvalidOperationException' in Microsoft.Framework.Configuration.Binder.dll
Additional information: Failed to convert 'http://feeds.d15.biz/Daniel15' to type 'System.Uri'.
at Microsoft.Framework.Configuration.ConfigurationBinder.CreateValueFromConfiguration(Type type, String value, IConfiguration configuration)
at Microsoft.Framework.Configuration.ConfigurationBinder.BindType(Type type, Object typeInstance, IConfiguration configuration)
at Microsoft.Framework.Configuration.ConfigurationBinder.BindProperty(PropertyInfo property, Object propertyOwner, IConfiguration configuration)
at Microsoft.Framework.Configuration.ConfigurationBinder.BindObjectProperties(Object obj, IConfiguration configuration)
at Microsoft.Framework.Configuration.ConfigurationBinder.Bind(Object model, IConfiguration configuration)
at Microsoft.Framework.OptionsModel.ConfigureFromConfigurationOptions`1.<>c__DisplayClass0_0.<.ctor>b__0(TOptions options)
at Microsoft.Framework.OptionsModel.ConfigureOptions`1.Configure(TOptions options, String name)
at Microsoft.Framework.OptionsModel.OptionsManager`1.<>c__DisplayClass5_0.<Configure>b__1(TOptions options, IConfigureOptions`1 setup)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
at Microsoft.Framework.OptionsModel.OptionsManager`1.Configure(String optionsName)
at Microsoft.Framework.OptionsModel.OptionsManager`1.GetNamedOptions(String name)
at Microsoft.Framework.OptionsModel.OptionsManager`1.get_Options()
at Daniel15.Web.Startup.<>c.<ConfigureServices>b__5_0(IServiceProvider provider) in C:\Users\danlo\Documents\Visual Studio 2015\Projects\dan.cx\Daniel15.Web\Startup.cs:line 31
InnerException: Invalid cast from 'System.String' to 'System.Uri'.