Skip to content

Latest commit

 

History

History
75 lines (65 loc) · 1.69 KB

README.md

File metadata and controls

75 lines (65 loc) · 1.69 KB

Overview

Dapper is a micro orm tool for .Net ado providers. The purpose of this library is to provide a tool that can be used in an easy and generic structure.

Covarage

Include providers

  • SQLite
  • SQL CE
  • Firebird
  • Oracle
  • MySQL
  • PostgreSQL
  • SQL Server

Installation

Nuget Package

Package Manager

Install-Package TStack.Dapper -Version 1.0.0

.NET CLI

dotnet add package TStack.Dapper --version 1.0.0

PackageReference

<PackageReference Include="TStack.Dapper" Version="1.0.0" />

Paket CLI

paket add TStack.Dapper --version 1.0.0

Usage

To use database classes must be inherited from the "IDapperEntity" class before

    [TableName("Employee")] //TableName mapping
    public class Employee : IDapperEntity<int>
    {
        [Primary]//primary key
        public int Id { get; set; }
        public string Name { get; set; }
        public string Surname { get; set; }
        [Excluded]//excluded field not updating on insert or update 
        public string Email { get; set; }
        public DateTime BirthDate { get; set; }
        public double Salary { get; set; }
    }

For connection class

public class TestConnection : DapperConnection
{
	public TestConnection() : base(@"Server=.\SQLEXPRESS;Database=TESTDB;Trusted_Connection=True;", 30)
	{
	}
}

For repository

public class EmployeeRepository : DapperRepository<Employee, int, TestConnection>
{
}

That's it, now repository access to usable methods.

Author

Ferhat Candaş - Software Developer