Alemvik 1.0.5

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

// Install Alemvik as a Cake Tool
#tool nuget:?package=Alemvik&version=1.0.5                

Alemvik

Packs many [mostly] static features

Demo for the Db class

appsettings.json

{
"DataSources": [
  { "MySqlSrvA": { "MySql.Data.MySqlClient": "DataSource=localhost;port=3306;Database=Skillango;uid=root;pwd=secret" } }
]
}
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Linq;
using Microsoft.Extensions.Configuration;
using Alemvik;

public static readonly IConfiguration config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();

static void InitDatabase() {
DbProviderFactories.RegisterFactory("MySql.Data.MySqlClient", MySql.Data.MySqlClient.MySqlClientFactory.Instance);

List<(string nme, string ado, string con)> dataSources = config.GetSection("DataSources")
  .Get<Dictionary<string, Dictionary<string, string>>[]>() // make sure you included Microsoft.Extensions.Configuration.Binder
  .SelectMany(i => i)
  .Select(i => ValueTuple.Create(i.Key, i.Value.First().Key, i.Value.First().Value))
  .ToList();
Db.Init(dataSources); // or direct: Db.Init(new Emvie.DataSource[] { new("MySqlSrvA", "MySql.Data.MySqlClient", "DataSource=localhost;port=3306;Database=Skillango;uid=root;pwd=secret") });
}

static void TestMySql() {
var tbl = Db.ToTbl("MySqlSrvA", 0, "select Name, Manager, Title from Skillango.User order by Name limit 25;", EFillOption.Data, 0, 15);
foreach (DataRow dr in tbl.Rows) Console.WriteLine($"{dr[0]}{new String(' ', Math.Max(40 - ((string)dr[0]).Length, 3))}{dr[1]}{new String(' ', Math.Max(30 - ((string)dr[1]).Length, 3))}{dr[2]}");

Db.BeginTransaction("MySqlSrvA");
int i = (int)Db.ExecNonQry("MySqlSrvA", 0, "update Skillango.User set Title='Cyber Security Specialist' where Name='Alain Trépanier';", 0);
Db.CommitTransaction("MySqlSrvA");

long count = (long)Db.ExecScalar("MySqlSrvA", 0, "select count(*) from Skillango.User where Name like @NameMask;", 0, "@NameMask", "a%");

tbl = Db.ToTbl("MySqlSrvA", 0, $"insert into Skillango.log (Type,Host,ApplicationUser,Application,Process,Message) values ('Warning','{Environment.MachineName} ({Environment.OSVersion})','{Environment.UserName}','Test','TestMySql','Msg6'), ('Message','{Environment.MachineName} ({Environment.OSVersion})','{Environment.UserName}','Test','TestMySql',@msg7); select ROW_COUNT(), LAST_INSERT_ID() as FirstAutoInc;", EFillOption.Data, 0, 0, "@msg7", "Message 7");

Console.WriteLine($"\n{i};{Db.ServerAndDbName("MySqlSrvA")};count={count}; RowCount: {tbl.Rows[0][0]}; FirstAutoInc: {tbl.Rows[0]["FirstAutoInc"]}");
}
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.1.1 508 7/7/2022
1.1.0 438 3/29/2022
1.0.5 549 1/18/2022
1.0.4 371 10/19/2021

Initial release