-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added better app config and moved sql to contrib
- Loading branch information
1 parent
00faaf5
commit 9ff702b
Showing
36 changed files
with
1,528 additions
and
14 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/FeatureToggles.Contrib.SqlProvider/FeatureToggles.Contrib.SqlProvider.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{0A03F567-003B-4192-BC83-CF12861DFAC9}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>FeatureToggles.Contrib.SqlProvider</RootNamespace> | ||
<AssemblyName>FeatureToggles.Contrib.SqlProvider</AssemblyName> | ||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Net.Http" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Providers\SqlDataProvider.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\FeatureToggles\FeatureToggles.csproj"> | ||
<Project>{ba473c25-d415-4323-8a7b-a4f34cf4fe43}</Project> | ||
<Name>FeatureToggles</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
36 changes: 36 additions & 0 deletions
36
src/FeatureToggles.Contrib.SqlProvider/Properties/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("FeatureToggles.Contrib.SqlProvider")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("FeatureToggles.Contrib.SqlProvider")] | ||
[assembly: AssemblyCopyright("Copyright © 2019")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("0a03f567-003b-4192-bc83-cf12861dfac9")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 18 additions & 1 deletion
19
src/FeatureToggles/Configuration/AppConfigurationProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace FeatureToggles.Configuration | ||
{ | ||
using System.Configuration; | ||
|
||
/// <summary> | ||
/// The url element represents the raw Xml config as an object | ||
/// </summary> | ||
public class IpAddressesElement : ConfigurationElement | ||
{ | ||
/// <summary> | ||
/// The url element value. This will be the fully qualified url for the endpoint | ||
/// </summary> | ||
[ConfigurationProperty("value", IsRequired = true)] | ||
public string Value => this["value"] as string; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/FeatureToggles/Configuration/IpAddressesElementCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
namespace FeatureToggles.Configuration | ||
{ | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
|
||
[ConfigurationCollection(typeof(IpAddressesElement), AddItemName = "ipaddress", CollectionType = ConfigurationElementCollectionType.BasicMap)] | ||
public class IpAddressesElementCollection : ConfigurationElementCollection, IEnumerable<IpAddressesElement> | ||
{ | ||
/// <summary> | ||
/// Gets or sets a url element from the collection by index | ||
/// </summary> | ||
/// <param name="index">The index</param> | ||
/// <returns>The url element</returns> | ||
public IpAddressesElement this[int index] | ||
{ | ||
get => BaseGet(index) as IpAddressesElement; | ||
set | ||
{ | ||
if (Count <= 0) | ||
{ | ||
BaseAdd(index, value); | ||
return; | ||
} | ||
|
||
if (BaseGet(index) != null) | ||
{ | ||
BaseRemoveAt(index); | ||
} | ||
|
||
BaseAdd(index, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Iterator for returning url elements from the collection | ||
/// </summary> | ||
/// <returns>A url element</returns> | ||
public new IEnumerator<IpAddressesElement> GetEnumerator() | ||
{ | ||
int count = Count; | ||
for (int i = 0; i < count; i++) | ||
{ | ||
yield return BaseGet(i) as IpAddressesElement; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Required protected method for returning a configuration element compatible with this | ||
/// collection | ||
/// </summary> | ||
/// <returns>The configuration element</returns> | ||
protected override ConfigurationElement CreateNewElement() | ||
{ | ||
return new IpAddressesElement(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the configuration element key from the provided element | ||
/// </summary> | ||
/// <param name="element">The configuration element base class</param> | ||
/// <returns>The actual instance required</returns> | ||
protected override object GetElementKey(ConfigurationElement element) | ||
{ | ||
return ((IpAddressesElement)element).Value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace FeatureToggles.Configuration | ||
{ | ||
using System.Configuration; | ||
|
||
/// <summary> | ||
/// The url element represents the raw Xml config as an object | ||
/// </summary> | ||
public class RoleElement : ConfigurationElement | ||
{ | ||
/// <summary> | ||
/// The unique url element key | ||
/// </summary> | ||
[ConfigurationProperty("name", IsRequired = true)] | ||
public string Name => this["name"] as string; | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
src/FeatureToggles/Configuration/RolesElementCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
namespace FeatureToggles.Configuration | ||
{ | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
|
||
[ConfigurationCollection(typeof(ToggleElement), AddItemName = "role", CollectionType = ConfigurationElementCollectionType.BasicMap)] | ||
public class RolesElementCollection : ConfigurationElementCollection, IEnumerable<RoleElement> | ||
{ | ||
/// <summary> | ||
/// Gets or sets a url element from the collection by index | ||
/// </summary> | ||
/// <param name="index">The index</param> | ||
/// <returns>The url element</returns> | ||
public RoleElement this[int index] | ||
{ | ||
get => BaseGet(index) as RoleElement; | ||
set | ||
{ | ||
if (Count <= 0) | ||
{ | ||
BaseAdd(index, value); | ||
return; | ||
} | ||
|
||
if (BaseGet(index) != null) | ||
{ | ||
BaseRemoveAt(index); | ||
} | ||
|
||
BaseAdd(index, value); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Iterator for returning url elements from the collection | ||
/// </summary> | ||
/// <returns>A url element</returns> | ||
public new IEnumerator<RoleElement> GetEnumerator() | ||
{ | ||
int count = Count; | ||
for (int i = 0; i < count; i++) | ||
{ | ||
yield return BaseGet(i) as RoleElement; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Required protected method for returning a configuration element compatible with this | ||
/// collection | ||
/// </summary> | ||
/// <returns>The configuration element</returns> | ||
protected override ConfigurationElement CreateNewElement() | ||
{ | ||
return new RoleElement(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the configuration element key from the provided element | ||
/// </summary> | ||
/// <param name="element">The configuration element base class</param> | ||
/// <returns>The actual instance required</returns> | ||
protected override object GetElementKey(ConfigurationElement element) | ||
{ | ||
return ((RoleElement)element).Name; | ||
} | ||
} | ||
} |
Oops, something went wrong.