CA.Blocks.SQLServerDataAccess 3.5.190-alpha

This is a prerelease version of CA.Blocks.SQLServerDataAccess.
There is a newer version of this package available.
See the version list below for details.
dotnet add package CA.Blocks.SQLServerDataAccess --version 3.5.190-alpha
                    
NuGet\Install-Package CA.Blocks.SQLServerDataAccess -Version 3.5.190-alpha
                    
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="CA.Blocks.SQLServerDataAccess" Version="3.5.190-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CA.Blocks.SQLServerDataAccess" Version="3.5.190-alpha" />
                    
Directory.Packages.props
<PackageReference Include="CA.Blocks.SQLServerDataAccess" />
                    
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 CA.Blocks.SQLServerDataAccess --version 3.5.190-alpha
                    
#r "nuget: CA.Blocks.SQLServerDataAccess, 3.5.190-alpha"
                    
#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 CA.Blocks.SQLServerDataAccess@3.5.190-alpha
                    
#: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=CA.Blocks.SQLServerDataAccess&version=3.5.190-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=CA.Blocks.SQLServerDataAccess&version=3.5.190-alpha&prerelease
                    
Install as a Cake Tool

NuGet version (CA.Blocks.DataAccess) Build Status

This Package is a extension to the DataAccess Blocks targeting the Sqllite provider

Quick example

poco object

    public class ExampleSysObject
	{
        public int Id { get; set; }
        public string Name { get; set; }
        public string XType { get; set; }
        public DateTime CreateDate { get; set; }
    }

The Data access class

    public class YourDataAccessClass : SqlServerDataAccess
    {
        public YourDataAccessClass() : 
            base( new SimpleConnectionStringDataAccessConfig("Server=(local);Database=tempdb;Integrated Security = SSPI; TrustServerCertificate=True"))            
        {

        }

       internal string ReadSysObjectsOfTypeSql => @"
SELECT  TOP 10 id as Id, name as Name, xtype as XType, crdate as CreateDate 
FROM  sysobjects 
WHERE xtype = @xtype";


		public IList<ExampleSysObject> ReadSysObjectsOfType(string xtype)
        {
            var cmd = CreateTextCommand(ReadSysObjectsOfTypeSql)
	            .WithParameter(xtype.ToSqlParameter("@xtype"));
            return Execute(cmd).ToListOf<ExampleSysObject>();
        }

        public async Task<IList<ExampleSysObject>> ReadSysObjectsOfTypeAsync(string xtype)
        {
            var cmd = CreateTextCommand(ReadSysObjectsOfTypeSql)
	            .WithParameter(xtype.ToSqlParameter("@xtype"));
            return await ExecuteAsync(cmd).ToListOf<ExampleSysObject>();
        }

        public async Task<IList<ExampleSysObject>> ReadSysObjectsOfTypeWithSqlBuilderAsync(string xtype)
        {
            var sqlBuilder = new SafeSqlBuilder();
            sqlBuilder.AddSql($"SELECT  TOP 10 id as Id, name as Name, xtype as XType, crdate as CreateDate FROM sysobjects WHERE xtype = {xtype:@xtype}");
            // this will build a valid sql statement with full parementer support. 
            // the sql will be "SELECT  TOP 10 id as Id, name as Name, xtype as XType, crdate as CreateDate FROM sysobjects WHERE xtype = @xtype}" with the xtype passed in as a parameter

            return await ExecuteAsync(sqlBuilder.BuildSqlCommand()).ToListOf<ExampleSysObject>();
        }

    }
    

Calling the data access class


    var instance = new YourDataAccessClass();
    var results  = instance.ReadSysObjectsOfType("U");
    foreach (var o in results)
    {
        Console.WriteLine($"{o.Id},{o.Name},{o.Type},{o.CreateDate}");
    }

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 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 is compatible.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
3.6.200 87 8/22/2025
3.6.199-prerelease 106 7/27/2025
3.5.197-prerelease 240 7/20/2025
3.5.195 886 5/14/2025
3.5.194-prerelease 236 5/14/2025
3.5.192-prerelease 127 5/3/2025
3.5.190-alpha 195 4/13/2025
3.5.187-prerelease 144 4/13/2025
3.4.172-prerelease 102 11/29/2024
3.4.160 1,114 11/17/2024
3.4.159-prerelease 113 10/24/2024
3.4.157 1,032 8/8/2024
3.4.156-prerelease 111 8/4/2024
3.4.154-prerelease 97 8/4/2024
3.4.152-prerelease 105 8/4/2024
3.4.149-prerelease 123 7/14/2024
3.4.147 179 6/22/2024
3.4.145-prerelease 130 5/27/2024
3.3.146 172 6/22/2024
3.3.143-prerelease 139 5/25/2024
3.3.138-prerelease 133 3/16/2024
3.3.136 1,238 2/24/2024
3.3.135-prerelease 131 2/24/2024
3.3.133-prerelease 136 2/24/2024
3.2.129 355 1/13/2024
3.2.128-prerelease 136 1/13/2024
3.2.127-prerelease 200 11/26/2023
3.2.126-prerelease 130 11/18/2023
3.2.125-prerelease 131 11/18/2023
3.1.124 248 11/17/2023
3.1.123-prerelease 135 11/17/2023
3.1.122 947 8/29/2023
3.1.121-prerelease 177 8/29/2023
3.1.120 282 8/14/2023
3.1.119-prerelease 184 8/14/2023
3.1.118 218 7/30/2023
3.1.117-prerelease 188 7/24/2023
3.1.116-prerelease 204 7/24/2023
3.1.115 239 6/26/2023
3.1.114-prerelease 179 6/11/2023
3.1.110 870 3/31/2023
3.1.109-prerelease 212 3/31/2023
3.1.108-prerelease 197 3/31/2023
3.1.107 308 3/28/2023
3.1.106-prerelease 209 3/28/2023
3.1.104 464 1/4/2023
3.1.103-prerelease 233 1/4/2023
3.1.102-prerelease 216 12/10/2022
3.1.101 1,963 11/21/2022
3.1.100-prerelease 234 11/13/2022
3.1.99-prerelease 226 11/5/2022
3.1.98-prerelease 734 11/2/2022
3.1.97-prerelease 206 11/2/2022
3.1.95-prerelease 223 11/1/2022
3.1.83 716 10/22/2022
3.0.73 523 10/10/2022
3.0.71 518 10/10/2022
3.0.69 635 9/14/2022
3.0.59 1,554 8/18/2022
3.0.56 573 8/10/2022
3.0.49 865 6/27/2022
3.0.48 640 6/14/2022
3.0.44 779 3/19/2022
3.0.38 641 3/4/2022
3.0.37 1,022 11/21/2021
3.0.35 594 11/3/2021
3.0.34 518 10/24/2021
2.2.26 556 2/20/2021
2.2.21 587 12/14/2020
2.2.19-CI-20200530-023939 602 5/30/2020
2.1.18-CI-20200514-060834 502 5/14/2020
2.1.16-CI-20200514-034352 493 5/14/2020
2.1.14-CI-20200131-034815 1,059 1/31/2020

v.3.5
- Added build packages for .NET 9
- Added SafeSqlBuilder to help build on sql statements based on Interpolated String with full parameter support
- Add SqlParameterHelper to help build sets of Sqlparamters with out using all the vebose synatax of using ToSqlParameter()