Alemvik 1.1.0

.NET 6.0
Install-Package Alemvik -Version 1.1.0
dotnet add package Alemvik --version 1.1.0
<PackageReference Include="Alemvik" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Alemvik --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Alemvik, 1.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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.1.0

// Install Alemvik as a Cake Tool
#tool nuget:?package=Alemvik&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Library in .Net 6 with C# 10. It packs many [mostly] static features.

Demo for the Db class


"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))
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]}");

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

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 Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
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.0 73 3/29/2022
1.0.5 147 1/18/2022
1.0.4 182 10/19/2021

Initial release