Energy.Core 20.12.12

There is a newer version of this package available.
See the version list below for details.
dotnet add package Energy.Core --version 20.12.12                
NuGet\Install-Package Energy.Core -Version 20.12.12                
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="Energy.Core" Version="20.12.12" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Energy.Core --version 20.12.12                
#r "nuget: Energy.Core, 20.12.12"                
#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 Energy.Core as a Cake Addin
#addin nuget:?package=Energy.Core&version=20.12.12

// Install Energy.Core as a Cake Tool
#tool nuget:?package=Energy.Core&version=20.12.12                

Energy Core Library

Energy.Core is a .NET class library which boosts your program with functionality covering various type conversions, utility classes, database abstraction layer, object mapping and simple application framework.

To be used by wide range of applications, services, web or console programs.

Filled with radioactive rays and made with love for you...

Installation

The easiest way is install using nuget either by finding Energy.Core package in official gallery or by executing command.

Install-Package Energy.Core

Installation package contains versions for .NET 4, .NET Standard / .NET Core and legacy .NET 2. Nuget should choose apropriate version automatically.

For Windows CE development Compact Framework package needs to be downloaded manually from GitHub.

Documentation

http://energy-core.readthedocs.io/

Examples

Safely converting value types

Conversion functions are located in Energy.Base.Cast class. These functions will try to convert value to desired type or use defaults if value cannot be converted.

int numberInt = Energy.Base.Cast.StringToInteger("123");
long numberLong = Energy.Base.Cast.StringToLong("1234567890");
double numberDouble = Energy.Base.Cast.StringToDouble("3.1415"); // or "3,1415"
Console.WriteLine(Energy.Base.Cast.DoubleToString(numberDouble));

Last will always result in culture invariant version "3.1415".

Displaying bytes in pretty format

byte[] array = Energy.Base.Random.GetRandomByteArray(40);
Console.WriteLine(Energy.Base.Hex.Print(array));

Which may result in example output.

2c c5 31 be  de 96 fb 5a  76 53 b7 84  2c 09 8d 16   ,.1....ZvS..,...
88 0f c5 6c  50 c3 69 51  48 99 4b 9f  53 00 79 89   ...lP.iQH.K.S y.
1d c9 de c6  4a c9 dc e2                             ....J...

This was very basic usage but you may extend it with different formatting options, offsets and even coloring.

Waiting for user input on console

When you call Console.ReadLine() program will stop and wait for user input. If you want to stop only when user enters data, use Energy.Core.Tilde.ReadLine() which will result in null as long as user has not accepted its input by pressing Enter key allowing your program to do its job.

Easily make REST requests

How about:

string url = "https://www.google.com/search?q=Energy";
Console.WriteLine(Energy.Core.Web.Get(url).Body);

Easy to use, build upon standard System.Net.WebRequest class REST functions available for common methods like GET, POST, PUT, PATCH, DELETE, HEAD or OPTIONS.

Generic SQL database connection

Here database connection is made using general connection class cooperating with each ADO.NET provider of the database connection.

Energy.Source.Connection<MySql.Data.MySqlClient.MySqlConnection> db
    = new Energy.Source.Connection<MySql.Data.MySqlClient.MySqlConnection>();
db.ConnectionString = @"Server=127.0.0.1;Database=test;Uid=test;Pwd=test;";
if (!db.Test())
{
    Console.WriteLine("Connection test error");
}
else
{
    string result = db.Scalar<string>("SELECT CURRENT_TIMESTAMP()");
    Console.WriteLine("Current server time is: {0}", result);
}

Connections are thread safe, may be cloned or even set to be persistent if you want to limit connections to your SQL database.

Content

Library has been divided into several different namespaces. Following table briefly describes the purpose of each of them.

  • Energy.Base - Contains base classes
  • Energy.Core - Library functions
  • Energy.Attribute - Attributes
  • Energy.Enumeration - Enumerations
  • Energy.Interface - Interfaces
  • Energy.Source - Database connection

History

Working for many years on different development projects, from simple applications, web applicatons, to a rich and monolithic production environment with plenty of small software programs that act as interfaces and all kinds of small services, as most of you have probably noticed that some part of the functionality is repeated to a greater or lesser extent regardless of the project type.

This library was created completely independently from my professional work as an attempt to build a "base", which can be quickly used in almost any project in order not to repeat again the same codes to achieve functionality like safe (international) type conversion or generic database connection which is easy and most importantly safe to use.

Greetings

To be continued...

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 net20 is compatible.  net35 is compatible.  net40 is compatible.  net403 was computed.  net45 was computed.  net451 was computed.  net452 was computed.  net46 was computed.  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.
  • .NETFramework 2.0

    • No dependencies.
  • .NETFramework 3.5

    • No dependencies.
  • .NETFramework 4.0

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
24.11.0 80 11/16/2024
20.12.21 416 4/5/2023
20.12.20 1,074 12/1/2021
20.12.19 518 11/7/2021
20.12.18 442 10/20/2021
20.12.17 419 10/6/2021
20.12.16 1,024 4/12/2021
20.12.15 481 2/25/2021
20.12.14 493 2/6/2021
20.12.13 474 1/31/2021
20.12.12 468 1/22/2021
20.12.11 491 1/17/2021
20.12.10 545 12/30/2020
18.12.35 563 12/20/2020
18.12.34 546 11/21/2020
18.12.33 597 10/20/2020
18.12.32 647 9/16/2020
18.12.31 579 8/20/2020
18.12.30 538 8/11/2020
18.12.29 569 5/27/2020
18.12.28 588 5/22/2020
18.12.27 561 5/13/2020
18.12.26 583 5/12/2020
18.12.25 611 5/5/2020
18.12.24 644 4/30/2020
18.12.23 626 4/1/2020
18.12.22 691 3/21/2020
18.12.21 628 3/8/2020
18.12.20 619 2/20/2020
18.12.19 763 2/16/2020
18.12.18 656 2/3/2020
18.12.17 610 1/31/2020
18.12.16 603 1/29/2020
18.12.15 631 1/20/2020
18.12.14 618 12/1/2019
18.12.12 646 10/17/2019
18.12.11 653 9/19/2019
18.12.10 649 8/13/2019
18.12.9 691 6/2/2019
18.12.8 693 5/26/2019
18.12.7 729 4/18/2019
18.12.6 721 3/26/2019
18.12.5 659 3/25/2019
18.12.4 667 3/7/2019
18.12.3 730 2/27/2019
18.12.2 856 12/2/2018
18.12.0 818 12/1/2018
18.11.1 804 11/17/2018
18.11.0 809 11/4/2018
18.10.0 870 10/10/2018
18.8.0 974 8/10/2018
18.7.0 895 7/31/2018
18.5.0 1,072 5/15/2018
18.3.0 1,113 3/24/2018
18.1.2 1,094 1/31/2018
18.1.1 1,301 1/23/2018
18.1.0 1,078 1/17/2018
17.12.0 1,080 12/29/2017
17.11.0 1,014 11/2/2017
17.10.3 1,008 10/20/2017
17.10.2 1,006 10/12/2017
17.10.1 1,004 10/10/2017
17.10.0 1,003 10/7/2017
17.9.4 982 9/27/2017
17.9.3 1,031 9/21/2017
17.9.2 1,013 9/17/2017
17.9.1 1,024 9/10/2017
17.9.0 993 9/6/2017
17.7.0 1,043 7/31/2017
17.6.0 1,040 6/30/2017
17.5.0 1,057 5/21/2017
16.10.0 1,070 3/1/2017
16.6.0 1,365 6/11/2016
16.5.0 1,074 5/19/2016
16.4.9 1,113 4/27/2016
16.4.8 1,172 4/24/2016
16.4.6 1,102 4/16/2016
16.4.5 1,074 4/13/2016
16.4.4 1,143 4/9/2016
16.4.3 1,159 4/9/2016
16.4.2 1,115 4/6/2016
16.4.1 1,071 4/2/2016
16.3.2 1,070 3/31/2016
16.3.1 1,104 3/16/2016
16.3.0 1,092 3/16/2016
16.2.3 1,457 2/28/2016
16.2.2 1,380 2/25/2016
16.2.1 1,972 2/24/2016
16.2.0 1,261 2/24/2016

How much reality can you take?