GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codeapologist/DataAbstractions.Dapper: A light abstraction around Dapper and Dapper.Contrib that also maintains the behavior IDbConnection.

BranchesTags
Open more actions menu

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
DataAbstractions.Dapper.sln
DataAbstractions.Dapper.sln
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

DataAbstractions.Dapper NuGet

A light abstraction around Dapper and Dapper.Contrib that also maintains the behavior IDbConnection. This library facilitates a loosely coupled design and unit testing.

IDataAccessor Interface

The IDataAccessor interface encapsulates Dapper extension methods. Just provide the connection to the DataAccessor.

IDataAccessor dataAccessor = new DataAccessor(new SqlConnection(connectionString));
        

Execute Dapper queries and commands as you would normally.

var person = await dataAccessor.QueryAsync<Person>(sql, new {Id});

Note: The dataAccessor should be disposed appropriately.

IDataReaderAccessor Interface

IDataReaderAccessor encapsulates IDataReader extension methods. Use GetDataReaderAccessor() to convert the IDataReader object to an IDataReaderAccessor.

var dataReader = await dataAccessor.ExecuteReaderAsync(sql);
var dataReaderAccessor = dataAccessor.GetDataReaderAccessor(dataReader);
var result = dataReaderAccessor.Parse<Person>();
        

Dapper.Contrib

IDataAccessor includes the Dapper.Contrib extension methods

dataAccessor.Insert(new Person { Name = "John Doe" });

Keeps IDbConnection behavior

IDataAccessor implements IDbConnection, so you can access things like the ConnectionTimeout, ConnectionString, and ConnectionState etc.

If you need access to the actual connection object, use GetUnderlyingConnection():

IDbConnection connection = dataAccessor.GetUnderlyingConnection();

About

A light abstraction around Dapper and Dapper.Contrib that also maintains the behavior IDbConnection.

Topics

abstractionsdapperidbconnectioninterfacemocktestabilitytestingunitwrapper

Resources

Readme
MIT license
Activity

Stars

38 stars

Watchers

2 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.