Skip to content

Commit

Permalink
Merge pull request #14 from TechNinjaLabs/release/4.0.0
Browse files Browse the repository at this point in the history
Release 4.0.0. - .Net 8.0 Upgrade.
  • Loading branch information
NinjaRocks authored Apr 5, 2024
2 parents 9f81e1b + 822283a commit b604a59
Show file tree
Hide file tree
Showing 216 changed files with 7,133 additions and 181 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/CI-Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
Run-Lint:
runs-on: ubuntu-latest
env:
github-token: '${{ secrets.GITHUB_TOKEN }}'
github-token: '${{ secrets.GH_PACKAGES }}'
steps:
- name: Step-01 Checkout code
uses: actions/checkout@v3
Expand All @@ -22,7 +22,7 @@ jobs:
VALIDATE_ALL_CODEBASE: false
FILTER_REGEX_INCLUDE: .*src/.*
DEFAULT_BRANCH: master
GITHUB_TOKEN: '${{ env.github-token }}'
GITHUB_TOKEN: '${{ secrets.GH_PACKAGES }}'
Build-Beta:
if: ${{ !startsWith(github.head_ref, 'release/')}}
runs-on: ubuntu-latest
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
outputs:
semVersion: ${{ needs.Build-Release.outputs.semVersion }}
env:
github-token: '${{ secrets.GITHUB_TOKEN }}'
github-token: '${{ secrets.GH_PACKAGES }}'
nuget-token: '${{ secrets.NUGET_API_KEY }}'
working-directory: /home/runner/work/FeatureOne/FeatureOne
steps:
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 3.0.0
next-version: 4.0.0
tag-prefix: '[vV]'
mode: ContinuousDeployment
branches:
Expand Down
2 changes: 1 addition & 1 deletion License.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Ninja Sha!4h
Copyright (c) 2024 Tech Ninja Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
34 changes: 25 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# <img src="https://github.com/NinjaRocks/FeatureOne/blob/master/ninja-icon-16.png" alt="ninja" style="width:30px;"/> FeatureOne v3.0.0

# <img src="https://github.com/NinjaRocks/FeatureOne/blob/master/ninja-icon-16.png" alt="ninja" style="width:30px;"/> FeatureOne v4.0.0
[![NuGet version](https://badge.fury.io/nu/FeatureOne.svg)](https://badge.fury.io/nu/FeatureOne) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/NinjaRocks/FeatureOne/blob/master/License.md) [![build-master](https://github.com/NinjaRocks/FeatureOne/actions/workflows/Build-Master.yml/badge.svg)](https://github.com/NinjaRocks/FeatureOne/actions/workflows/Build-Master.yml) [![GitHub Release](https://img.shields.io/github/v/release/ninjarocks/FeatureOne?logo=github&sort=semver)](https://github.com/ninjarocks/FeatureOne/releases/latest)
[![CodeQL](https://github.com/NinjaRocks/FeatureOne/actions/workflows/codeql.yml/badge.svg)](https://github.com/NinjaRocks/FeatureOne/actions/workflows/codeql.yml) [![.Net](https://img.shields.io/badge/.Net%206.0-blue)](https://dotnet.microsoft.com/en-us/download/dotnet/6)
[![CodeQL](https://github.com/NinjaRocks/FeatureOne/actions/workflows/codeql.yml/badge.svg)](https://github.com/NinjaRocks/FeatureOne/actions/workflows/codeql.yml) [![.Net](https://img.shields.io/badge/.Net-8.0-blue)](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)

.Net Library to implement feature toggles.
--
Expand Down Expand Up @@ -311,12 +312,24 @@ SQL support can easily be installed as a separate nuget package.
```
$ dotnet add package FeatureOne.SQL --version {latest}
```
Supports Db Providers `MSSQL: System.Data.SqlClient`, `ODBC: System.Data.Odbc`, `OLEDB: System.Data.OleDb`, `SQLite: System.Data.SQLite`, `MySQL: MySql.Data.MySqlClient` & `PostgreSQL: Npgsql`.
### Step 1 - Configure Database Provider
To register a database provider, You need to add the relevant db factory with a specific `ProviderName` to `DbProviderFactories` in the bootstrap code.
ie.
`DbProviderFactories.RegisterFactory("ProviderName", ProviderFactory)`

After adding the provider factory you need to pass the same provider in the `connection settings` of SQLConfiguration.

> Below is the list of most common provider factories yu could configure.
>
- MSSQL - DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);
- ODBC - DbProviderFactories.RegisterFactory("System.Data.Odbc", OdbcFactory.Instance);
- OleDb - DbProviderFactories.RegisterFactory("System.Data.OleDb", OleDbFactory.Instance);
- SQLite - DbProviderFactories.RegisterFactory("System.Data.SQLite", SQLiteFactory.Instance);
- MySQL - DbProviderFactories.RegisterFactory("MySql.Data.MySqlClient", MySqlClientFactory.Instance);
- PostgreSQL - DbProviderFactories.RegisterFactory("Npgsql", NpgsqlFactory.Instance);
>
For any other SQL provider, You need to add provider factory to `DbProviderFactories.RegisterFactory("ProviderName", ProviderFactory)` and pass the provider specific `connection settings` in SQLConfiguration.
### Database Setup
### STEP 2 - Setup Feature Table (Database)
> Requires creating a feature table with columns for feature name, toggle definition and feature archival.
SQL SCRIPT below.
Expand All @@ -329,7 +342,7 @@ CREATE TABLE TFeatures (
);
```

### Example Table Record
#### Example Table Record
> Feature toggles need to be `scripted` to backend database in JSON format.
Please see example entries below.
Expand All @@ -339,8 +352,8 @@ Please see example entries below.
| dashboard_widget |{ "conditions":[{ "type":"Simple", "isEnabled": true }] } | false |
|pen_test_dashboard| { "operator":"any", "conditions":[{ "type":"simple", "isEnabled":false}, { "type":"Regex", "claim":"email","expression":"^[a-zA-Z0-9_.+-][email protected]" }]} | false|

### Bootstrap initialization
> See below bootstrap initialization for FeatureOne with SQL backend.
### STEP 3 - Bootstrap initialization
> See below bootstrap initialization for FeatureOne with MS SQL backend.

#### SQL Configuration - Set connection string and other settings.
Expand All @@ -350,7 +363,7 @@ Please see example entries below.
// provider specific connection settings.
ConnectionSettings = new ConnectionSettings
{
Providername = DbProviderName.MSSql,
Providername = "System.Data.SqlClient", -- same provider name as register with db factory.
ConnectionString ="Data Source=Powerstation; Initial Catalog=Features; Integrated Security=SSPI;"
},
Expand All @@ -377,6 +390,9 @@ Please see example entries below.
```
i. With SQL configuration.
```
-- Register db factory
DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);
var storageProvider = new SQlStorageProvider(sqlConfiguration);
Features.Initialize(() => new Features(new FeatureStore(storageProvider)));
```
Expand Down
32 changes: 17 additions & 15 deletions src/FeatureOne.File/FeatureOne.File.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>disable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
Expand All @@ -13,26 +13,28 @@
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Title>FeatureOne.File</Title>
<Authors>ninja.shayk</Authors>
<Company>Ninja.Sha!4H</Company>
<Authors>Tech Ninja Labs</Authors>
<Company>Tech Ninja Labs</Company>
<Product>FeatureOne</Product>
<Description>.Net library to implement feature toggles using File system storage.</Description>
<Copyright>Copyright (c) 2023 Ninja Sha!4h</Copyright>
<Description>.Net library to implement feature toggles with File system storage.</Description>
<Copyright>Copyright (c) 2024 Tech Ninja Labs</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/NinjaRocks/FeatureOne</RepositoryUrl>
<RepositoryUrl>https://github.com/TechNinjaLabs/FeatureOne</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>feature-toggle; feature-flag; feature-flags; feature-toggles; .netstandard2.1; featureOne; File-system; File-Backend; File-Toggles;</PackageTags>
<Version>3.0.0</Version>
<PackageTags>feature-toggle; feature-flag; feature-flags; feature-toggles; .net8.0; featureOne; File-system; File-Backend; File-Toggles;</PackageTags>
<Version>4.0.0</Version>
<PackageLicenseFile>License.md</PackageLicenseFile>
<PackageIcon>ninja-icon-16.png</PackageIcon>
<PackageReleaseNotes>
Release Notes v3.0.0. - Targets .Net 6.0
Adds support for File system storage provider for implementing Feature Toggles stored on file.
- Provides memory caching enabled via configuration.
- Added extensibility for Custom implementations-
- Provides extension point to support more SQL providers.
- Provides extenion point for custom caching.
- Provides extension point for custom deserializer for Toggle Conditions.
Release Notes v4.0.0. - Targets .Net 8.0
Library to Implement Feature Toggles to hide/show program features with File system storage.
- Provides Out of box Simple and Regex toggle conditions.
- Provides Out of box support for File system storage provider to store toggles on disk file.
- Provides the support for default memory caching via configuration.
- Provides extensibility for custom implementations ie.
-- Provides extensibility for implementing custom toggle conditions for bespoke use cases.
-- Provides extensibility for implementing custom caching provider.
-- Provides extensibility for implementing custom toggle deserializer for bespoke scenarios.
</PackageReleaseNotes>
</PropertyGroup>

Expand Down
42 changes: 19 additions & 23 deletions src/FeatureOne.SQL/FeatureOne.SQL.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
Expand All @@ -14,27 +14,29 @@
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Title>FeatureOne.SQL</Title>
<Authors>ninja.shayk</Authors>
<Company>Ninja.Sha!4H</Company>
<Authors>Tech Ninja Labs</Authors>
<Company>Tech Ninja Labs</Company>
<Product>FeatureOne</Product>
<Description>.Net library to implement feature toggles with SQL backend.</Description>
<Copyright>Copyright (c) 2023 Ninja Sha!4h</Copyright>
<Description>.Net library to implement feature toggles with SQL storage.</Description>
<Copyright>Copyright (c) 2024 Tech Ninja Labs</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/NinjaRocks/FeatureOne</RepositoryUrl>
<RepositoryUrl>https://github.com/TechNinjaLabs/FeatureOne</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>feature-toggle; feature-flag; feature-flags; feature-toggles; .netstandard2.1; featureOne; SQL-Backend; SQL-Toggles; SQL</PackageTags>
<Version>3.0.0</Version>
<PackageTags>feature-toggle; feature-flag; feature-flags; feature-toggles; .net8.0; featureOne; SQL-Backend; SQL-Toggles; SQL</PackageTags>
<Version>4.0.0</Version>
<PackageLicenseFile>License.md</PackageLicenseFile>
<PackageIcon>ninja-icon-16.png</PackageIcon>
<PackageReleaseNotes>
Release Notes v3.0.0. - Targets .Net 6.0
Adds support for SQL storage provider for implementing Feature Toggles.
- Supports MSSQL, SQLite, ODBC, OLEDB, MySQL, PostgreSQL Db providers.
- Provides memory caching - enabled via configuration.
- Added extensibility for Custom implementations-
- Provides extension point to support more SQL providers.
- Provides extenion point for custom caching.
- Provides extension point for custom deserializer for Toggle Conditions.
Release Notes v4.0.0. - Targets .Net 8.0
Library to Implement Feature Toggles to hide/show program features with SQL storage.
- Supports configuring all Db providers - MSSQL, SQLite, ODBC, OLEDB, MySQL, PostgreSQL.
- Provides Out of box Simple and Regex toggle conditions.
- Provides the support for default memory caching via configuration.
- Provides extensibility for custom implementations ie.
-- Provides extensibility for implementing custom toggle conditions for bespoke use cases.
-- Provides extensibility to plugin other SQL providers.
-- Provides extensibility for implementing custom caching providers.
-- Provides extensibility for implementing custom toggle deserializer for bespoke scenarios.
</PackageReleaseNotes>
</PropertyGroup>

Expand All @@ -54,14 +56,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Npgsql" Version="7.0.4" />
<PackageReference Include="System.Data.Common" Version="4.3.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Data.Odbc" Version="7.0.0" />
<PackageReference Include="System.Data.OleDb" Version="7.0.0" />
<PackageReference Include="System.Data.SQLite" Version="1.0.86" />
<PackageReference Include="MySql.Data" Version="8.0.33" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
32 changes: 3 additions & 29 deletions src/FeatureOne.SQL/StorageProvider/DbRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,17 @@
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.Odbc;
using System.Data.OleDb;
using System.Data.SqlClient;
using System.Data.SQLite;
using System.Linq;
using MySql.Data.MySqlClient;
using Npgsql;

namespace FeatureOne.SQL.StorageProvider
{
internal class DbRepository : IDbRepository
{
private readonly SQLConfiguration sqlConfiguration;

public DbRepository(SQLConfiguration configuration)
public DbRepository(SQLConfiguration sqlConfiguration)
{
this.sqlConfiguration = configuration ?? throw new ArgumentNullException(nameof(SQLConfiguration));

var names = DbProviderFactories.GetProviderInvariantNames();

if (!names.Any(x => x.Equals("System.Data.SqlClient") && SqlClientFactory.Instance != null))
DbProviderFactories.RegisterFactory("System.Data.SqlClient", SqlClientFactory.Instance);

if (!names.Any(x => x.Equals("System.Data.Odbc")) && OdbcFactory.Instance != null)
DbProviderFactories.RegisterFactory("System.Data.Odbc", OdbcFactory.Instance);

if (!names.Any(x => x.Equals("System.Data.OleDb")) && OleDbFactory.Instance != null)
DbProviderFactories.RegisterFactory("System.Data.OleDb", OleDbFactory.Instance);

if (!names.Any(x => x.Equals("System.Data.SQLite")) && SQLiteFactory.Instance != null)
DbProviderFactories.RegisterFactory("System.Data.SQLite", SQLiteFactory.Instance);

if (!names.Any(x => x.Equals("MySql.Data.MySqlClient")) && MySqlClientFactory.Instance != null)
DbProviderFactories.RegisterFactory("MySql.Data.MySqlClient", MySqlClientFactory.Instance);

if (!names.Any(x => x.Equals("Npgsql")) && NpgsqlFactory.Instance != null)
DbProviderFactories.RegisterFactory("Npgsql", NpgsqlFactory.Instance);
this.sqlConfiguration = sqlConfiguration ??
throw new ArgumentNullException(nameof(SQLConfiguration));
}

public DbRecord[] GetByName(string name)
Expand Down
12 changes: 6 additions & 6 deletions src/FeatureOne/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
using System;
using System.Reflection;

[assembly: System.Reflection.AssemblyCompanyAttribute("Ninja.Sha!4H")]
[assembly: System.Reflection.AssemblyCompanyAttribute("Tech Ninja Labs")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("2023")]
[assembly: System.Reflection.AssemblyCopyrightAttribute("2024")]
[assembly: System.Reflection.AssemblyDescriptionAttribute(".Net Library to implement feature toggles.")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("2.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.7")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("4.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("FeatureOne")]
[assembly: System.Reflection.AssemblyTitleAttribute("FeatureOne")]
[assembly: System.Reflection.AssemblyVersionAttribute("2.0.0.0")]
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/NinjaRocks/FeatureOne")]
[assembly: System.Reflection.AssemblyVersionAttribute("4.0.0.0")]
[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/TechNinjaLabs/FeatureOne")]

// Generated by the MSBuild WriteCodeFragment class.

33 changes: 17 additions & 16 deletions src/FeatureOne/FeatureOne.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>disable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
Expand All @@ -14,31 +14,32 @@
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Title>FeatureOne</Title>
<Authors>ninja.shayk</Authors>
<Company>Ninja.Sha!4H</Company>
<Authors>Tech Ninja Labs</Authors>
<Company>Tech Ninja Labs</Company>
<Product>FeatureOne</Product>
<Description>.Net library to implement feature toggles (Need to implement storage backend).</Description>
<Copyright>Copyright (c) 2023 Ninja Sha!4h</Copyright>
<Description>.Net library to implement feature toggles.</Description>
<Copyright>Copyright (c) 2024 Tech Ninja Labs</Copyright>
<PackageReadmeFile>README.md</PackageReadmeFile>
<RepositoryUrl>https://github.com/NinjaRocks/FeatureOne</RepositoryUrl>
<RepositoryUrl>https://github.com/TechNinjaLabs/FeatureOne</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>feature-toggle; feature-flag; feature-flags; feature-toggles; .netstandard2.1; featureOne</PackageTags>
<Version>3.0.0</Version>
<PackageTags>feature-toggle; feature-flag; feature-flags; feature-toggles; net8.0; featureOne</PackageTags>
<Version>4.0.0</Version>
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
<PackageIcon>ninja-icon-16.png</PackageIcon>
<PackageReleaseNotes>
Release Notes v3.0.0 Core Functionality :- Targets .Net 6.0
- To Implement Feature Toggles to hide/show program features.
- Provides Out of box Simple and Regex toggle conditions .
- Provides extensibility for custom implementation
- to implement custom toggle conditions for any bespoke use case.
- to implement backend storage. No Backend storage exists by default.
Release Notes v4.0.0 Core Functionality :- Targets .Net 8.0
Library to Implement Feature Toggles to hide/show program features. Does not contain storage provider.
- Provides Out of box Simple and Regex toggle conditions.
- Provides extensibility for custom implementations ie.
-- No storage exists by default. Requires `IStorageProvider` implementation to plugin in backend data store for stored features.
-- Provides extensibility to implement custom toggle conditions for bespoke use cases.
-- Provides extensibility for custom toggle deserializer for bespoke scenarios.
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Runtime.Caching" Version="7.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="System.Runtime.Caching" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit b604a59

Please sign in to comment.