SqlServerExplorerLib 1.7.0
dotnet add package SqlServerExplorerLib --version 1.7.0
NuGet\Install-Package SqlServerExplorerLib -Version 1.7.0
<PackageReference Include="SqlServerExplorerLib" Version="1.7.0" />
<PackageVersion Include="SqlServerExplorerLib" Version="1.7.0" />
<PackageReference Include="SqlServerExplorerLib" />
paket add SqlServerExplorerLib --version 1.7.0
#r "nuget: SqlServerExplorerLib, 1.7.0"
#:package SqlServerExplorerLib@1.7.0
#addin nuget:?package=SqlServerExplorerLib&version=1.7.0
#tool nuget:?package=SqlServerExplorerLib&version=1.7.0
SqlServerExplorerLib
Low-level, async-first SQL Server operations with minimal overhead.
SqlServerExplorerLib is focused on practical data access tasks such as:
- validating connectivity,
- inspecting tables and columns,
- running raw SQL queries,
- exporting
DataTableresults to delimited files, - and performing fast bulk-copy transfers between sources.
Installation
Package Manager:
Install-Package SqlServerExplorerLib
.NET CLI:
dotnet add package SqlServerExplorerLib
Quick start
using SqlServerExplorerLib;
using System.Data;
var sql = new SqlServerExplorer();
string cs = "my_connection_string";
Dependency injection is also supported:
var host = Host
.CreateDefaultBuilder()
.ConfigureServices(services => services.AddSingleton<SqlServerExplorer>())
.Build();
var logger = host.Services.GetRequiredService<ILoggerFactory>().CreateLogger("SQLServerExplorer");
var configuration = host.Services.GetRequiredService<IConfiguration>();
string cs = configuration.GetConnectionString("Default")!;
var sql = host.Services.GetRequiredService<SqlServerExplorer>();
string tableName = "TEST_TABLE";
Core capabilities
Connectivity
bool ok = await sql.TestConnection(cs);
Optional timeout:
bool ok = await sql.TestConnection(cs, timeoutInSeconds: 5);
Schema exploration
GetTables(connectionString)GetFields(connectionString, SqlServerTable)TableExists(connectionString, tableName)
List<SqlServerTable> tables = await sql.GetTables(cs);
var myTable = tables.First(t => t.Name == tableName);
List<SqlServerField> fields = await sql.GetFields(cs, myTable);
Record and table utilities
IsTableEmpty(connectionString, tableName)GetRecordsCount(connectionString, tableName)GetRecordsCount(connectionString, SqlServerTable)TruncateTable(connectionString, tableName)
Raw SQL operations
SqlServerExplorer supports both plain and parameterized overloads:
Execute(...)Query(...)QueryScalar<T>(...)
await sql.Execute(cs, "create table [TEST_TABLE](id int, name nvarchar(50), value float)");
int count = await sql.QueryScalar<int>(cs, "select count(*) from [TEST_TABLE]");
DataTable data = await sql.Query(cs, "select * from [TEST_TABLE]");
Data preview and export
GetTopRecords(connectionString, table, count)QueryToFile(connectionString, sqlText, targetFile, fieldSeparator)SaveToFile(DataTable, targetFile, fieldSeparator)
DataTable preview = await sql.GetTopRecords(cs, myTable, count: 200);
DataTable all = await sql.QueryToFile(cs, "select * from [TEST_TABLE]", "./mydata.csv", ";");
sql.SaveToFile(all, "./mydata.csv", ";");
Bulk copy
Use high-throughput copy operations with global settings:
BatchSizeBulkCopyTimeoutInSecondsLoadedDataeventCopyTo(targetConnectionString, DataTable, destinationTableName)CopyTo(sourceConnectionString, targetConnectionString, SqlServerTable, destinationTableName?)
sql.BulkCopyTimeoutInSeconds = 0; // 0 = no timeout
sql.BatchSize = 0; // 0 = all rows in one batch
sql.LoadedData += (_, _) => logger.LogInformation("Data has been loaded.");
await sql.CopyTo(cs, all, destinationTableName: "OTHER_TABLE");
Additional existing capabilities
SqlServerService base class (advanced/low-level)
For custom services, derive from SqlServerExplorerLib.DataServices.SqlServerService and use:
GetDataTableGetDataSetGetScalar<T>ExecuteNonQueryGetList<T>GetStringListGetSingleRowBulkCopy
This provides a low-level async API while keeping full control of SQL and mapping.
Data conversion helpers
Namespace: SqlServerExplorerLib.DataServices
DataTableExtensions.ToList<T>()DataTableExtensions.ToArray<T>()DataTableExtensions.ToStringArray(useEmptyStringForNull)DataTableExtensions.ToStringList(useEmptyStringForNull)DataRowExtensions.ForceReadDouble/Int/String/Bool/DateTime(...)DataRowExtensions.SafeReadEnum<T>(...)
Metadata models
SqlServerTable(schema + name + formatted[schema].[name]output)SqlServerField(position, CLR type, SQL type, max length, nullability)
Notes
- Most operations are async and intended to be awaited.
- A defensive
try/catcharound integration code is recommended. - For best safety, prefer parameterized SQL overloads whenever possible.
| 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
- CsvReaderAdvanced (>= 2.6.0)
- Microsoft.Data.SqlClient (>= 7.0.2)
- Microsoft.SqlServer.Types (>= 170.1000.7)
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.7.0 | 98 | 7/15/2026 |
| 1.6.9 | 318 | 2/21/2025 |
| 1.6.8 | 237 | 2/5/2025 |
| 1.6.7 | 218 | 2/5/2025 |
| 1.6.5 | 223 | 2/5/2025 |
| 1.6.4 | 217 | 2/5/2025 |
| 1.6.3 | 218 | 12/21/2024 |
| 1.6.2 | 294 | 12/7/2024 |
| 1.6.1 | 226 | 12/7/2024 |
| 1.6.0 | 224 | 12/7/2024 |
| 1.5.0 | 216 | 12/7/2024 |
| 1.3.0 | 239 | 7/27/2024 |
| 1.2.1 | 343 | 10/15/2023 |
| 1.2.0 | 243 | 10/15/2023 |
| 1.1.0 | 250 | 10/15/2023 |