Closed abombss closed 10 years ago
I like this idea, but I don't know exactly how it should work. Take the following example:
dynamic config = new Configuration();
var value = config.SettingsClass.PropertyValue;
What should the default behavior be when SettingsClass
isn't defined in the config file? If it's not found, currently, null is returned and then a NullReferenceException is thrown on PropertyValue.
I think the best option is to throw a custom exception, but I really try to make Formo fall back to sensible defaults and require try/catches.
I'm open to any ideas or thoughts on this.
Interesting, i wasn't thinking that use case, i was just thinking it would
only work for bind
I might have to think about that use case.
Adam On Jan 26, 2014 6:40 PM, "Chris Missal" notifications@github.com wrote:
I like this idea, but I don't know exactly how it should work. Take the following example:
dynamic config = new Configuration(); var value = config.SettingsClass.PropertyValue;
What should the default behavior be when SettingsClass isn't defined in the config file? If it's not found, currently, null is returned and then a NullReferenceException is thrown on PropertyValue.
I think the best option is to throw a custom exception, but I really try to make Formo fall back to sensible defaults and require try/catches.
I'm open to any ideas or thoughts on this.
— Reply to this email directly or view it on GitHubhttps://github.com/ChrisMissal/Formo/issues/26#issuecomment-33335832 .
With the upcoming null propagating
C# language feature this might be worth another look.
Hey all, how are we feeling about this?
A common convention is to use period separated strings. Looking for keys with the following might be useful, not sure if it breaks backwards compat.