jason-roberts / FeatureToggle

Simple, reliable feature toggles in .NET
http://dontcodetired.com/blog/?tag=/featuretoggle
Apache License 2.0
689 stars 111 forks source link

SqlFeatureToggle - generic config #152

Open ximon opened 6 years ago

ximon commented 6 years ago

Currently the SqlFeatureToggle requires a connection string / connection string name and a SQL statement per toggle.

When multiple toggles are implemented it would be nicer to be able to provide a generic SqlFeatureToggle connection string / connection string name and SQL statement - this can be selected as a fallback so that the specific keys are selected, then the generic one.

Instead of the following:

<add key="FeatureToggle.MyAwesomeFeature1.ConnectionStringName" value="Database" />
<add key="FeatureToggle.MyAwesomeFeature1.SqlStatement" value="select Value from Toggle where ToggleName = 'MyAwesomeFeature1'"/>

<add key="FeatureToggle.MyAwesomeFeature2.ConnectionStringName" value="Database" />
<add key="FeatureToggle.MyAwesomeFeature2.SqlStatement" value="select Value from Toggle where ToggleName = 'MyAwesomeFeature2'"/>

<add key="FeatureToggle.MyAwesomeFeature2.ConnectionStringName" value="Database" />
<add key="FeatureToggle.MyAwesomeFeature2.SqlStatement" value="select Value from Toggle where ToggleName = 'MyAwesomeFeature3'"/>

Have this:

<add key="FeatureToggle.SqlFeatureToggle.ConnectionStringName" value="Database" />
<add key="FeatureToggle.SqlFeatureToggle.SqlStatement" value="select Value from Toggle where ToggleName = '{name}'"/>

I can submit a PR if required.

jason-roberts commented 6 years ago

Hi @ximon thanks for the suggestion, please hold of on the PR for the moment as I want to consider v5 and how that may affect toggle configuration.

andregeuze commented 5 years ago

@jason-roberts Hi Jason, any update on this topic?