BertoSoftware.DapperContext.SqlServer 0.3.0-alpha

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

image

Documentation is still under development

DapperContext

A simple collections of functions and method for CRUD operation in Dapper for generic item with or without an integrated audit system.


Preface

This utility allows you to speed up CRUD operations with Dapper by writing less code. The 'utility already integrates the connection system to various database providers such as:

  • SQL Server
  • MySQL / Maria DB
  • Oracle
  • SQLite

This utility arose from the need to avoid instantiating a connection context each time and perform all CRUD operations without having to write the database access each time; it should better facilitate operations with Dapper.

I also created another project derived from this one, which is called DapperAuditContext. This project allows you to add attributes to model classes that allows you to track changes made to that specific table or specific table field. The result can be saved automatically to a table within your own database, and the operation is automatic, or saved to a readable text file.

Information about packages

To install the program simply download the nuget package(s) related to your needs.

There are several nuget packages available that you can install. The packages are these:

  • DapperContext

    • This is the core package that is mandatory for other and will not work alone
  • DapperAuditContext

    • This is the core audit package that is mandatory only if you need to trail changes and will not work alone
  • DapperContext.SqlServer (recommended package)

    • This package allows you to connect to a Microsoft SQL Server and is dependent on the core package. With this package you can use all the functions available to you
  • DapperAuditContext.SqlServer (recommended package)

    • Same that DapperContext.SqlServer but with a integated audit system

Installation

Install main core package via NuGet

PM > Install-Package BertoSoftware.DapperContext

Install sql server package via NuGet

PM > Install-Package BertoSoftware.DapperContext.SqlServer

Examples

Create a model class that respect the same on your database

VB.NET

Imports Dapper.Contrib.Extensions

Namespace Model

    <Table("Person")> 
    Public Class Person
        <Key>
        Public Property ID As Integer
        Public Property Name As String
        Public Property Surname As String
        Public Property Address As String
    End Class

End Namespace

C#

using Dapper.Contrib.Extensions;

namespace Model
{

    [Table("Person")]
    public partial class Person
    {
        [Key]
        public int ID { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }
        public string Address { get; set; }
    }
}
Product 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 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 Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on BertoSoftware.DapperContext.SqlServer:

Package Downloads
BertoSoftware.DapperAuditContext.SqlServer

A simple collections of functions and method for CRUD operation in Dapper for generic item with an integrated audit system

GitHub repositories

This package is not used by any popular GitHub repositories.