Alemvik 1.1.1
dotnet add package Alemvik --version 1.1.1
NuGet\Install-Package Alemvik -Version 1.1.1
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.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Alemvik --version 1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Alemvik, 1.1.1"
#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.1.1 // Install Alemvik as a Cake Tool #tool nuget:?package=Alemvik&version=1.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Alemvik
Library in .Net 6 with C# 10. It 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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.
-
net6.0
- Microsoft.Extensions.Configuration (>= 6.0.1)
- Microsoft.Extensions.Configuration.Binder (>= 6.0.0)
- Microsoft.Extensions.Configuration.Json (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
- System.Data.SqlClient (>= 4.8.3)
- System.Runtime.Caching (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release