SqlServerDB_dotNET.Core
1.0.0
dotnet add package SqlServerDB_dotNET.Core --version 1.0.0
NuGet\Install-Package SqlServerDB_dotNET.Core -Version 1.0.0
<PackageReference Include="SqlServerDB_dotNET.Core" Version="1.0.0" />
<PackageVersion Include="SqlServerDB_dotNET.Core" Version="1.0.0" />
<PackageReference Include="SqlServerDB_dotNET.Core" />
paket add SqlServerDB_dotNET.Core --version 1.0.0
#r "nuget: SqlServerDB_dotNET.Core, 1.0.0"
#:package SqlServerDB_dotNET.Core@1.0.0
#addin nuget:?package=SqlServerDB_dotNET.Core&version=1.0.0
#tool nuget:?package=SqlServerDB_dotNET.Core&version=1.0.0
SqlServerDB_dotNET.Core (Modern .NET)
SqlServerDB_dotNET.Core è una libreria di alto livello che semplifica la connessione a
Microsoft SQL Server e l’esecuzione di query in .NET moderno.
Questo pacchetto è progettato esclusivamente per .NET moderno (net10.0) ed è basato su
Microsoft.Data.SqlClient, il provider ufficiale e supportato per SQL Server.
⚠️ Nota Per applicazioni .NET Framework (4.x) esiste un pacchetto legacy separato.
Questo package NON supporta .NET Framework.
✨ Funzionalità
- Connessione semplificata a SQL Server
- Supporto a:
- SQL Authentication
- Windows Authentication
- Wrapper ad alto livello per:
- SELECT (
DataTable) - INSERT / UPDATE / DELETE
- SELECT (
- Recupero informazioni:
- versione SQL Server
- timeout di connessione
- numero record interessati
- ultimo ID inserito
- Gestione errori centralizzata
- Compatibile con applicazioni cross-platform (Windows, Linux, macOS)
📦 Requisiti
- .NET 10.0
- SQL Server (locale o remoto)
- Driver incluso:
Microsoft.Data.SqlClient
📥 Installazione
CLI
dotnet add package SqlServerDB_dotNET.Core
Package Manager
Install-Package SqlServerDB_dotNET.Core
🚀 Quick Start
using System;
using System.Data;
using SqlServerDB;
class Program
{
static void Main()
{
string connectionString =
"Data Source=SERVER\\INSTANCE;" +
"Initial Catalog=MyDatabase;" +
"User ID=sa;" +
"Password=MyPassword;" +
"Trusted_Connection=False;" +
"Encrypt=True;" +
"TrustServerCertificate=True;" +
"Connect Timeout=60;";
using DBConnection db = new DBConnection(connectionString);
if (!db.IsConnected())
{
Console.WriteLine("Connessione non riuscita.");
return;
}
Console.WriteLine($"SQL Server Version: {db.GetVersion()}");
DataTable table = db.SelectTable("SELECT TOP 10 * FROM MyTable;");
foreach (DataRow row in table.Rows)
{
Console.WriteLine(row[0]);
}
}
}
🔐 Connection string – esempi
SQL Authentication (consigliata)
Data Source=SERVER\INSTANCE;
Initial Catalog=MyDatabase;
User ID=sa;
Password=MyPassword;
Trusted_Connection=False;
Encrypt=True;
TrustServerCertificate=True;
Windows Authentication
Data Source=SERVER\INSTANCE;
Initial Catalog=MyDatabase;
Trusted_Connection=True;
Encrypt=True;
TrustServerCertificate=True;
❗ Non mescolare
Trusted_Connection=TrueconUser ID / Password.
📚 API – Panoramica
Costruttore
DBConnection(string connectionString)
Proprietà
string Serverstring Databasestring UserIDstring Password
Metodi
bool IsConnected()string GetVersion()int GetConnectionTimeout()DataTable SelectTable(string sql)bool sql_query(string sql)string[] sql_error()int GetLastInsertedRowID()int GetNumRecordsAffected()
La classe implementa
IDisposable: usa sempreusing.
🔒 Sicurezza
Gli esempi utilizzano SQL testuali per semplicità.
In produzione è fortemente consigliato:
- usare query parametriche
- usare stored procedure
- non loggare connection string complete
🛠️ Troubleshooting
Errore SSL / Certificato
Aggiungi:
Encrypt=True;TrustServerCertificate=True;
Login failed for user
- verifica Mixed Mode Authentication
- verifica username/password
- verifica istanza (
SERVER\SQLEXPRESS)
IsConnected() restituisce false
- controlla
sql_error() - verifica firewall / TCP/IP
- aumenta
Connect Timeout
🧭 Compatibilità
| Piattaforma | Supporto |
|---|---|
| .NET 10 | ✅ |
| .NET 8 / 7 / 6 | ❌ |
| .NET Framework | ❌ |
| Windows | ✅ |
| Linux | ✅ |
| macOS | ✅ |
📄 Licenza
Consulta la pagina NuGet del pacchetto per dettagli su licenza e changelog.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.Data.SqlClient (>= 5.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.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 182 | 1/16/2026 |
Extensions on the SqlServerDB .NetFramework.