ZayniFramework.Common 2.3.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ZayniFramework.Common --version 2.3.2
NuGet\Install-Package ZayniFramework.Common -Version 2.3.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZayniFramework.Common" Version="2.3.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ZayniFramework.Common --version 2.3.2
#r "nuget: ZayniFramework.Common, 2.3.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ZayniFramework.Common as a Cake Addin
#addin nuget:?package=ZayniFramework.Common&version=2.3.2

// Install ZayniFramework.Common as a Cake Tool
#tool nuget:?package=ZayniFramework.Common&version=2.3.2

Zayni Framework


  • Create By: Lin, Ping-chen
  • Create Date: 2016-05-17
  • Update Date: 2019-04-04

The Zayni Framework is an application framework developed in C# programming language with .NET Standard 2.0. The Zayni Framework is try to help every .NET developer to build their applications and libraries easier. The concept is make every C# code or .NET libraries reusable, flexible and combinable.

Zayni Framework provide many kinds of common used libraries, extensions and service middleware framework for any .NET application (both .NET Core or .NET Framework application). If you want to know how to use Zayni Framework, you can take a look from the unit test projects or other test projects.

The modules in the Zayni Framework:

  • Common module (Configs, interfaces, extensions, AOP interceptors, dynamic, reflections and converters... etc)
  • Caching module (Memory, Redis, MySQL Memory Table Engine, ZayniFramework.Remote.ShareData.Service.)
  • Caching.RemoteCache module (Out-process remote cache service library.)
  • Caching.RedisClient module (The Redis client components.)
  • Compression module (Provide GZip compression and extensions.)
  • Cryptography module (AES, DES, SHA256, SHA512... etc and KeyMaker SDK tool.)
  • Data Access & ORM module (Micro ORM, dynamic ORM for data access. Support the SQL Server and MySQL, SQL logging and database mirgarion CLI tool.)
  • Data Access with LightORM module (Provide CRUD ORM DataContext template & SQL Engine.)
  • Exception Handling module (Exception handler & exception policies.)
  • Formatting module (Numerical data format, DateTime format, masking... etc)
  • Logging module (Log event delegate, file log, console log, database log, email log & windows event log.)
  • Serialization module (Json.NET, Jil, XML, BinaryFormatter & ZeroFormatter.)
  • Validation module (Provide validator and many kinds of validtion attributes.)
  • Middle.Service (Self-hosted middleware framework. Support multi-hosted remote host services like: TCP Socket, WebSocket, RabbitMQ and also In-Process service mode.)
  • Middle.Service.Client module (The client-side proxy for Middle.Service module. Provide remote client such as the TCPSocket, WebSocket, RabbitMQ and In-Process Proxy to connect and access the Middle.Service remote host service.)
  • Middle.Service.Entity module (The entities and DTOs for service middleware.)
  • Middle.Service.Grpc module (The extension module for Middle.Service module. It provide the gRPC remote service host which is very fast RPC communication. You don't need to know any details about gRPC or ProtoBuf anymore. Just use the Middle.Service module to write your ServiceAction and you will have the benefit in gRPC and Zayni Framework both! 😃 )
  • Middle.Service.Grpc.Client module (The extension module for Middle.Service.Client module. It provide the gRPC remote client.)
  • Middle.Service.Grpc.Entity module (The extension module for Middle.Service.Entity module.)
  • Middle.Service.HttpCore module (The extension module for Middle.Service module. It provide the ASP.NET Core Kestrel self-hosted http remote service. Using this extension module allow you to have more flexible in your application. You can build the http microservice in you existed console apps or any .NET Core applications, not just only in a ASP.NET Core website application.)
  • Middle.Service.HttpCore.Client module (The extension module for Middle.Service.Client module. It provide the http remote client.)
  • Middle.TelnetService module (Self-hosted telnet service for any .NET application)
  • Remote.ShareData.Service

Here is the overview and main concept about the Zayni Framework.

You are welcome to contact with me if you have any questions or advises. Or create an new issue in this project. My email address is ponylin1985@gmail.com.

How to use Zayni Framework and Sample Code.

Add namespace using in your code.

using ZayniFramework.Common;

Configuration API example.

Read the app.config sample.

If you app.config's location is the same with your entry assembly. You can also use ConfigurationManager to read the configurations.<br/> BUT if your app.config's location is placed in different path with your entry assembly in runtime. You need to set the app.config file path to ConfigManagement.ConfigFullPath property before you using any Zayni Framework's module or libraries. So, the Zayni Framework can load all the configurations correctlly.

// This is the case that you place your app.config in different path with your entry assembly. You need to set the ConfigManagement.ConfigFullPath property before you using any Zayni Framework's module.
// If the app.config's path is the same with your entry assembly. You don't need to set the ConfigManagement.ConfigFullPath property.
// You app.config full path here...
var path = $"{Path.GetDirectoryName( Assembly.GetExecutingAssembly().Location )}/Configs/WebAPI.Test.dll.config";
ConfigManagement.ConfigFullPath = path;

In your app.config.

<connectionStrings>
    <add name="AAA" connectionString="SERVER=XXX.XXX.XXX.XXX;Port=3306;DATABASE=zayni;UID=XXX;PASSWORD=XXX;Allow User Variables=True;Charset=utf8;Convert Zero Datetime=True;"       providerName="MySql.Data.MySqlClient"/>
    <add name="BBB" connectionString="Server=XXX.XXX.XXX.XXX,1433;Database=ZayniFramework;User Id=XXX;Password=XXX;Max Pool Size=20;Min Pool Size=5;Connection Lifetime=30;" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
    <add key="ABC" value="Hello, Zayni Framework" />
    <add key="DEF" value="Zayni Framework with Docker" />
    <add key="WWW" value="true" />
</appSettings>

Then you can read the configurations like this.

// Read the connection string.
string connectionStringA = ConfigManagement.ConnectionStrings[ "AAA" ].ConnectionString;
string connectionStringB = ConfigManagement.ConnectionStrings[ "BBB" ].ConnectionString;

// Read the appSettings
string a = ConfigManagement.AppSettings[ "ABC" ];
string b = ConfigManagement.AppSettings[ "DEF" ];

// or your can read appSettings like this.
Result r = await AppSettingsLoader.Instance.LoadBooleanConfigSettingAsync( "WWW" );
Assert.IsTrue( r.Success );
Assert.IsTrue( r.Data.Value );  // r.Data.Value is a Boolean type. The value will be true
Read the json config sample.

If you have a JSON file as a configuarion file like xxx.json. You can use ConfigManager.GetConfig( string path ) method to read the json config file.

// The path of your json config file.
string configPath = "./someDir/someConfig.json";

// Load the json configs with dynamic type.
dynamic configs = ConfigManager.GetConfig( configPath );

// Load the json configs with strong C# type. You can define the strong type class if you want.
var cfg = ConfigManager.GetConfig<TheStrongConfigType>( configPath );
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (21)

Showing the top 5 NuGet packages that depend on ZayniFramework.Common:

Package Downloads
ZayniFramework.Logging

This is a built-in logging module for ZayniFramework. You can use the zayni.json to configure how the log message should stored. Support file log, elasticsearch log, relational database log (MSSQL, MySQL, Postgres and Oracle), email notification, console log and windows event log. Also you can define the logging event handler, then you can pipe your log message to anywhere you want such as AWS CludeWatch or GCP StackDriver. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

ZayniFramework.Serialization

The serialization module support JSON (System.Text.Json or Newtonsoft.Json), YAML (YamlDotNet) or XML serialization. You can also define your own serialization component and register it into SerializerFactory. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

ZayniFramework.Validation

The Validation module provide many kinds of validation attributes and Validator for .NET applications. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

ZayniFramework.Middle.Service.Entity

The Middle.ServiceHost.Entity define the entities and DTOs for Middle.ServiceHost and Middle.ServiceHost.Client module. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

ZayniFramework.DataAccess

This is a lightweight ORM framework like Dapper but also provider DbCommand SQL log. Support Microsoft SQL Server, MySQL, PostgreSQL and Oracle database. Also support dynamic ORM. GitLab Repository: https://gitlab.com/ponylin1985/zayniframework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.142 253 3/19/2024
8.0.141 499 1/4/2024
8.0.140 615 12/17/2023
6.0.138 388 3/19/2024
6.0.137 1,233 9/20/2023
6.0.136 1,114 9/14/2023
6.0.135 1,149 9/10/2023
6.0.134 1,363 7/12/2023
6.0.133 1,424 7/10/2023
6.0.132 1,406 7/7/2023
6.0.131 1,443 6/19/2023
6.0.130 1,479 6/19/2023
6.0.129 13,614 7/2/2022
6.0.128 4,227 1/16/2022
6.0.127 4,020 1/15/2022
6.0.126 4,005 1/15/2022
6.0.125 2,452 1/8/2022
6.0.125-hotfix2 465 1/15/2022
6.0.125-hotfix1 1,380 1/8/2022
6.0.124 2,473 1/7/2022
6.0.123 2,852 11/14/2021
5.0.129 5,563 7/2/2022
5.0.128 5,637 1/16/2022
5.0.125 3,124 1/8/2022
5.0.124 3,042 1/7/2022
5.0.123 3,665 11/14/2021
5.0.122 4,071 10/11/2021
5.0.121 4,196 5/1/2021
3.1.137 2,061 9/20/2023
3.1.136 1,824 9/14/2023
3.1.135.1 345 9/13/2023
3.1.135 2,060 9/10/2023
3.1.134 2,412 7/12/2023
3.1.133 2,489 7/11/2023
3.1.132 2,468 7/8/2023
3.1.131 2,611 6/19/2023
3.1.130 4,624 2/1/2023
3.1.129 8,350 7/2/2022
3.1.128 8,538 1/16/2022
3.1.125 4,433 1/8/2022
3.1.124 4,541 1/7/2022
3.1.123 5,484 11/14/2021
3.1.122 6,207 10/11/2021
3.1.121 6,329 5/1/2021
2.31.120 4,139 3/14/2021
2.30.115 7,590 3/6/2021
2.30.114 4,008 3/6/2021
2.20.101 4,558 3/1/2021
2.19.3 4,148 2/11/2021
2.19.2 16,656 2/6/2021
2.19.1 4,541 1/6/2021
2.19.0 4,634 1/1/2021
2.18.3 7,621 12/27/2020
2.18.2 8,706 8/29/2020
2.18.1 11,815 8/26/2020
2.18.0 8,099 8/20/2020
2.17.135 7,934 8/19/2020
2.17.134 12,005 7/28/2020
2.17.133 7,875 7/27/2020
2.17.132 8,039 7/18/2020
2.17.131 8,084 7/11/2020
2.16.130 7,831 6/13/2020
2.15.128 8,034 6/3/2020
2.15.127 8,056 5/31/2020
2.15.126 9,011 4/30/2020
2.14.122 7,751 4/13/2020
2.13.100 7,917 3/12/2020
2.12.51 7,806 2/18/2020
2.11.50 14,710 2/10/2020
2.10.44 16,412 1/30/2020
2.9.43 16,158 1/11/2020
2.8.42 16,652 1/10/2020
2.8.41 16,205 1/5/2020
2.7.40 16,029 1/2/2020
2.7.39 16,126 1/2/2020
2.7.38 16,770 1/1/2020
2.6.37 16,476 12/23/2019
2.6.35 16,540 12/4/2019
2.6.1 16,149 12/2/2019
2.6.0 16,165 11/28/2019
2.5.2 16,736 11/26/2019
2.5.1 16,065 11/12/2019
2.5.0 15,894 11/9/2019
2.4.3 14,393 10/16/2019
2.4.2 13,453 10/16/2019
2.4.1 13,684 9/20/2019
2.3.113 3,987 3/6/2021
2.3.112 4,048 3/6/2021
2.3.28 13,965 9/19/2019
2.3.27 13,961 8/30/2019
2.3.26 14,144 8/20/2019
2.3.25 13,582 8/12/2019
2.3.22 14,125 7/31/2019
2.3.21 14,334 7/20/2019
2.3.20 13,194 6/22/2019
2.3.19 13,879 6/14/2019
2.3.18 14,411 6/13/2019
2.3.17 13,817 6/13/2019
2.3.15 13,715 6/8/2019
2.3.14 13,772 6/8/2019
2.3.13 14,213 5/30/2019
2.3.12 7,808 5/24/2019
2.3.11 7,731 5/24/2019
2.3.10 8,017 5/21/2019
2.3.9 7,698 5/9/2019
2.3.8 7,990 5/8/2019
2.3.7 7,898 4/30/2019
2.3.6 7,943 4/23/2019
2.3.5 7,903 4/19/2019
2.3.4 7,734 4/18/2019
2.3.3 7,678 4/17/2019
2.3.2 7,759 4/6/2019
2.3.1 7,868 12/15/2018
2.3.0 7,666 12/7/2018
2.2.6 11,392 11/25/2018
2.2.3 4,613 11/23/2018
2.2.2 6,815 11/20/2018
2.2.1 9,230 11/17/2018
2.2.0 6,575 11/16/2018
2.1.0 6,756 11/15/2018
2.0.1 5,572 11/6/2018
2.0.0 5,573 11/4/2018