nuPickers icon indicating copy to clipboard operation
nuPickers copied to clipboard

Add a DefaultValue option to the DotNetDataSourceAttribute

Open Hendy opened this issue 9 years ago • 1 comments

see: https://our.umbraco.org/projects/backoffice-extensions/nupickers/questionssuggestions/73892-setting-default-selection-in-nupickers

Hendy avatar Jan 04 '16 09:01 Hendy

If configured via an attribute, I would recommend the string specified in the attribute be the name of the property that will return the default value. This is in contrast to actually specifying the default value in the attribute, as doing that would be much less dynamic. You'll note that the thread you link to shows an example of me allowing the user to configure their own default.

An alternative would be to change the IDotNetDataSource interface to add a method (e.g., GetDefault), though that would then break any existing classes that implement that interface. Another alternative would be to provide a second interface (e.g., IDotNetDataSourceWithDefault) that includes the original interface. Yet another alternative would be to provide an entirely separate interface (e.g., IDefaultableDataSource).

I'm not sure which of those options is the best one, but thought I'd mention them.

Nicholas-Westby avatar Jan 04 '16 18:01 Nicholas-Westby