DbLibConnectorjh 1.0.2
dotnet add package DbLibConnectorjh --version 1.0.2
NuGet\Install-Package DbLibConnectorjh -Version 1.0.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="DbLibConnectorjh" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DbLibConnectorjh" Version="1.0.2" />
<PackageReference Include="DbLibConnectorjh" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DbLibConnectorjh --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DbLibConnectorjh, 1.0.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.
#:package DbLibConnectorjh@1.0.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DbLibConnectorjh&version=1.0.2
#tool nuget:?package=DbLibConnectorjh&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DbLib - MySQL Access Library
Version: 1.0.2
Autor: Jan Herrmann
Lizenz: MIT
Beschreibung
DbLib ist eine C#-Bibliothek, die eine einfache und sichere Möglichkeit bietet, mit einer MySQL-Datenbank zu interagieren. Die Bibliothek bietet Funktionen für:
- Datenbankverbindung (Herstellen und Schließen von Verbindungen)
- CRUD-Operationen (SELECT, INSERT, UPDATE, DELETE)
- Fehlerhandling mit detaillierten Rückgabewerten (Enums)
Diese Bibliothek ist ideal für Entwickler, die eine robuste und leicht zu integrierende Lösung für MySQL-Datenbanken benötigen.
Features
- Einfache Handhabung von Verbindungen: Automatisches Öffnen und Schließen von Verbindungen.
- Umfassendes Fehlerhandling: Unterstützt verschiedene Fehlertypen, einschließlich Verbindungsprobleme, Syntaxfehler und Datenintegritätsprobleme.
- Erweiterbare Architektur: Die Schnittstelle
IConnectorkann implementiert werden, um andere Datenbanktypen zu unterstützen. - Logging-Unterstützung: Integriert mit
Microsoft.Extensions.Logging, um detaillierte Logs bereitzustellen.
Voraussetzungen
- .NET Version:
.NET 6.0oder höher - MySQL Datenbank: Version 5.7 oder höher
- NuGet-Pakete:
Installation
Installiere das Paket über den NuGet-Paketmanager:
NuGet Package Manager
Install-Package DbLib
1. Verbindung herstellen
using DbLib;
using Microsoft.Extensions.Logging;
// Logger-Konfiguration
ILogger<MySqlAccess> logger = new LoggerFactory().CreateLogger<MySqlAccess>();
// Verbindung erstellen
var dbAccess = new MySqlAccess("localhost", "myDatabase", "username", "password", logger);
// Verbindungsstatus überprüfen
if (dbAccess.flagStatus == errorValues.Success)
{
Console.WriteLine("Verbindung erfolgreich hergestellt!");
}
else
{
Console.WriteLine($"Fehler beim Verbindungsaufbau: {dbAccess.flagStatus}");
}
2. Daten abrufen (SELECT)
var result = dbAccess.select("id, name", "users", "age > 18", "id ASC");
if (result == errorValues.Success)
{
Console.WriteLine("Daten erfolgreich abgerufen!");
}
else
{
Console.WriteLine($"Fehler bei der SELECT-Abfrage: {result}");
}
3. Daten einfügen (INSERT)
var result = dbAccess.insert("users", "'John', 'Doe', 30");
if (result == errorValues.Success)
{
Console.WriteLine("Daten erfolgreich eingefügt!");
}
else
{
Console.WriteLine($"Fehler beim INSERT: {result}");
}
4. Daten aktualisieren (UPDATE)
var result = dbAccess.update("users", "name = 'Jane Doe'", "id = 1");
if (result == errorValues.Success)
{
Console.WriteLine("Daten erfolgreich aktualisiert!");
}
else
{
Console.WriteLine($"Fehler beim UPDATE: {result}");
}
5. Daten löschen (DELETE)
var result = dbAccess.delete("users", "age < 18", "10");
if (result == errorValues.Success)
{
Console.WriteLine("Daten erfolgreich gelöscht!");
}
else
{
Console.WriteLine($"Fehler beim DELETE: {result}");
}
Fehlercodes
Success = Operation erfolgreich.
UnknownError = Ein unbekannter Fehler ist aufgetreten.
QueryError= Fehler in der SQL-Abfrage.
NoData = Keine Daten gefunden.
EmptyInputParameters = Ungültige oder leere Eingabeparameter.
DatabaseNotFound = Die angegebene Datenbank wurde nicht gefunden.
DuplicateEntry = Duplikatfehler (PRIMARY KEY/UNIQUE verletzt).
TableNotFound = Die angegebene Tabelle existiert nicht.
MIT License
Copyright (c) [2024] [Jan Herrmann]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Karambolo.Extensions.Logging.File (>= 3.6.0)
- Microsoft.Extensions.Logging (>= 9.0.0)
- MySql.Data (>= 9.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.