Twileloop.ExpressData
1.0.0
Prefix Reserved
This package is no more maintained by the Author. Visit https://packages.twileloop.com/ for new packages
dotnet add package Twileloop.ExpressData --version 1.0.0
NuGet\Install-Package Twileloop.ExpressData -Version 1.0.0
<PackageReference Include="Twileloop.ExpressData" Version="1.0.0" />
paket add Twileloop.ExpressData --version 1.0.0
#r "nuget: Twileloop.ExpressData, 1.0.0"
// Install Twileloop.ExpressData as a Cake Addin #addin nuget:?package=Twileloop.ExpressData&version=1.0.0 // Install Twileloop.ExpressData as a Cake Tool #tool nuget:?package=Twileloop.ExpressData&version=1.0.0
Express.Data
If your project needs to fire queries to a relational database often at different places of your code. This lightweight library will be helpfull.
Express.Data allows playing with database queries easy by making use of Dapper, DapperContrib and DTO classes. Examples are provided below. This library is a wrapper around the popular Dapper micro ORM and it's extension Dapper.Contrib. It works with any relational database and runs over ADO.NET and DapperMicroORM
The library exposes easy to use API for all kind of database CRUD operations.
Package Manager
The library will be soon available on NuGet
Versions
Version Information
Version | Change log | dll Download |
---|---|---|
v1.1 | Basic CRUD Operations support under SqlHelper class | Download |
Repository Contents
This repo maintains 2 projects. The main library and a demo project to implement it
PreRequesties
Before running the demo program
- Create a table named tblUsers
- Create 3 columns Id, Fname and Lname
- Set the connection string to database server inside Main()
Usage
C# POCO Model building. The model should be decorated with Dapper.Contrib attributes for proper working. Here is an example
using Dapper.Contrib.Extensions;
namespace Demo
{
[Table("tblUser")]
public class tblUser
{
[Key]
public int Id { get; set; }
public string FName { get; set; }
public string LName { get; set; }
[Computed]
public string Fullname { get; set; }
}
}
Insert a model
var record = new tblUser {
Id = 1,
FName = "Sangeeth",
LName = "Nandakumar"
};
var primaryKey = SqlHelper.Insert < tblUser > (record, _connectionString);
Update a model
record = new tblUser {
Id = 1,
FName = "Navaneeth",
LName = "Nandakumar"
};
var isUpdated = SqlHelper.Update < tblUser > (record, _connectionString);
Run a query
var sql1 = $ "SELECT * FROM tblUser WHERE Id=1";
var result = SqlHelper.Query < tblUser > (sql1, _connectionString).FirstOrDefault();
Run a safe query (Parameterised query)
var sql2 = $ "SELECT * FROM tblUser WHERE Id=@id AND Fname=@fname";
result = SqlHelper.QuerySafe < tblUser > (sql2, new {
id = 1,
fname = "Navaneeth"
},
_connectionString);
Run a stored procedure
var procedureName = $ "spGetUsers";
result = SqlHelper.Execute < tblUser > (procedureName, new {
id = 1
},
_connectionString).FirstOrDefault();
Product | Versions 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 was computed. 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. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Dapper (>= 2.0.35)
- Dapper.Contrib (>= 2.0.35)
- System.Data.SqlClient (>= 4.8.1)
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 | 603 | 7/30/2020 |
Initial release