VOOZH about

URL: https://www.nuget.org/packages/Kull.Data/

⇱ NuGet Gallery | Kull.Data 10.1.0




Kull.Data 10.1.0

dotnet add package Kull.Data --version 10.1.0
 
 
NuGet\Install-Package Kull.Data -Version 10.1.0
 
 
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="Kull.Data" Version="10.1.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kull.Data" Version="10.1.0" />
 
Directory.Packages.props
<PackageReference Include="Kull.Data" />
 
Project file
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 Kull.Data --version 10.1.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Kull.Data, 10.1.0"
 
 
#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 Kull.Data@10.1.0
 
 
#: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=Kull.Data&version=10.1.0
 
Install as a Cake Addin
#tool nuget:?package=Kull.Data&version=10.1.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Kull.Data Database Access

This Library extends the .Net Standard DBA Classes like System.Data.Common.DbConnection or System.Data.Common.DbDataReader with some extension methods that makes them easiert to use. You can use this a very simple ORM Mapper as well, without the need of a full-bown Entity Framework. A good alternative is Dapper.

Install it using Nuget, Package "Kull.Data":

👁 NuGet Badge

Some Examples

You always need to be using Kull.Data to use the extension methods.

Call a Stored Procedure

using (var con = Kull.Data.DatabaseUtils.GetConnectionFromConfig("SomeConfigConnstr"))
{
 return con.CreateSPCommand("spGetSomeData")
 .AddCommandParameter("NameOfParameter", 1)
 .AddCommandParameter("NameofOtherPArameter", 2)
 .AsCollectionOf<SomeClassName>() // As of v6, a C# 9 record can be used here
}

Call a Stored Procedure, but use default DataReader

System.Data.Common.DbCommand cmd = con.CreateSPCommand("spGetSomeData")
 .AddCommandParameter("NameOfParameter", 1)
 .AddCommandParameter("NameofOtherPArameter", 2);

using(var rdr = cmd.ExecuteReader())
{
 rdr.Read();
 return rdr.GetNInt16(2); // Use Kull.Data Extension method that handles null-values for you (No System.DBNull Checking anymore...)
}

Abstraction of Config

You can simple call Kull.Data.DatabaseUtils.GetConnectionFromConfig("NAMEOFCONNECTIONSTRING") and it will return your DbConnection.

It works in the following order:

  • Look in System.Configuration.ConfigurationManager.ConnectionStrings (.Net Fx only)
  • Look in System.Configuration.ConfigurationManager.AppSettings (.Net Fx only)
  • Look in appsettings.json (.Net Core only)
  • Look in Environment Variables

When looking into Environment Variables, the ones of Azure functions are the base. We support the following prefixes:

  • No prefix, meaning just NAMEOFCONNECTIONSTRING in the example above
  • SQLCONNSTR_
  • SQLAZURECONNSTR_
  • MYSQLCONNSTR_
  • PostgreSQLCONNSTR_
  • CUSTOMCONNSTR_

Other Feature: WrapperDataReader and ObjectDataReader

For SQL Bulk Copy or other things it can be useful to pass C# Data as a DataReader. You can achieve that by using Kull.Data.DataReader.ObjectDataReader. If you need to add some columns to a datareader, you can use Kull.Data.DataReader.WrappedDataReader.

Powershell Module

At first, I do not recommend Powershell for such stuff at all because of the following issue: https://github.com/PowerShell/PowerShellGet/issues/381 Prefer doing such stuff in C# directly. If you really want to, you can still use this Powershell module.

You can use the Kull.Data.Powershell Module to use some simple cmdlets that allow for querying stored procedures(queries with parameters easily.

Import-Module SqlServer # To load System.Data.SqlClient driver in Powershell 6.2+
Import-Module Kull.Data.Powershell 
$allAssemblies = [appdomain]::currentdomain.GetAssemblies() | ForEach-Object { [IO.Path]::GetFileName($_.Location) } # we try to be ready when SqlServer Module uses Microsoft.Data.SqlClient
if($allAssemblies.Contains("System.Data.SqlClient.dll") -and -not $allAssemblies.Contains("Microsoft.Data.SqlClient.dll")){
 $provider = "System.Data.SqlClient"
} else {
 $provider = "Microsoft.Data.SqlClient"
}
if($firstLoad -and $provider -eq "System.Data.SqlClient"){
 [System.Data.Common.DbProviderFactories]::RegisterFactory($provider, [System.Data.SqlClient.SqlClientFactory]::Instance)
}
else {
 [System.Data.Common.DbProviderFactories]::RegisterFactory($provider, [Microsoft.Data.SqlClient.SqlClientFactory]::Instance)
}
$sqlcon = Connect-Database $connectionstring $provider
Send-DbCommand $sqlcon $commandText $parameters ([System.Data.CommandType]::StoredProcedure)
# Or, use Receive-DbData to get result list

Run Tests in Docker Container

  1. To create the image, execute the following command in the directory of the docker file
    docker build . -t sqlserver_sqltoolsservice --no-cache 
    
  2. To execute the docker container, use the following command
    docker run -d -p 1433:1433 --name sqlserver sqlserver_sqltoolsservice 
    
  3. Now you have a working SQL server for development and testing purpose. To run the test, connect to the container and navigate to the Kull.Data.Test and execute dotnet test
Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 is compatible. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 is compatible.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 is compatible.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Kull.Data:

Package Downloads
Kull.DatabaseMetadata

Package Description

Kull.GenericBackend

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.1.0 277 12/5/2025
8.0.1 1,190 11/26/2023
8.0.1-alpha 156 11/11/2023
6.1.3 590 5/7/2023
6.1.2 4,381 11/11/2022
6.1.1 765 10/21/2022
6.1.0 627 9/22/2022
6.1.0-beta8 683 7/30/2022
6.1.0-beta7 297 7/30/2022
6.1.0-beta6 332 7/15/2022
6.1.0-beta5 326 7/8/2022
6.1.0-beta4 331 7/8/2022
6.1.0-beta3 308 7/7/2022
6.1.0-beta2 325 7/7/2022
6.1.0-beta1 330 7/7/2022
6.0.5 1,673 6/22/2022
6.0.4 602 6/14/2022
6.0.3 2,183 3/21/2022
6.0.2 879 3/18/2022
6.0.1 883 1/12/2022
Loading failed