All Projects → codeapologist → DataAbstractions.Dapper

codeapologist / DataAbstractions.Dapper

Licence: MIT license
A light abstraction around Dapper and Dapper.Contrib that also maintains the behavior IDbConnection.

Programming Languages

C#
18002 projects
TSQL
950 projects

Projects that are alternatives of or similar to DataAbstractions.Dapper

Thinktecture.Abstractions
Interfaces for commonly used .NET types like `File`, `Directory`, `Stream`, `Path`, `Math`, `Environment`, `Task`, etc. for better testability.
Stars: ✭ 25 (-32.43%)
Mutual labels:  abstractions, testability
ineeda
Mocking library for TypeScript and JavaScript using Proxies!
Stars: ✭ 53 (+43.24%)
Mutual labels:  mock, unit
jest-launchdarkly-mock
Easily unit test LaunchDarkly feature flagged components with jest
Stars: ✭ 14 (-62.16%)
Mutual labels:  mock, unit
Sinon Jest Cheatsheet
Some examples on how to achieve the same goal with either of both libraries: sinon and jest. Also some of those goals achievable only by one of these tools.
Stars: ✭ 226 (+510.81%)
Mutual labels:  mock
Node Mock Server
File based Node REST API mock server
Stars: ✭ 225 (+508.11%)
Mutual labels:  mock
Shallow Render
Angular testing made easy with shallow rendering and easy mocking. https://getsaf.github.io/shallow-render
Stars: ✭ 242 (+554.05%)
Mutual labels:  mock
go-github-mock
A library to aid unittesting code that uses Golang's Github SDK
Stars: ✭ 63 (+70.27%)
Mutual labels:  mock
Mockery
A mock code autogenerator for Golang
Stars: ✭ 3,138 (+8381.08%)
Mutual labels:  mock
Mujina
A mock IDP and SP using the OpenSAML library
Stars: ✭ 250 (+575.68%)
Mutual labels:  mock
Faker
Provides fake data to your Android apps :)
Stars: ✭ 234 (+532.43%)
Mutual labels:  mock
Okhttp Json Mock
Mock your datas for Okhttp and Retrofit in json format in just a few moves
Stars: ✭ 231 (+524.32%)
Mutual labels:  mock
Jest Mock Extended
Type safe mocking extensions for Jest https://www.npmjs.com/package/jest-mock-extended
Stars: ✭ 224 (+505.41%)
Mutual labels:  mock
Vuex Mock Store
✅Simple and straightforward Vuex Store mock for vue-test-utils
Stars: ✭ 246 (+564.86%)
Mutual labels:  mock
Pester
Pester is the ubiquitous test and mock framework for PowerShell.
Stars: ✭ 2,620 (+6981.08%)
Mutual labels:  mock
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (+583.78%)
Mutual labels:  mock
Dgate
an API Gateway based on Vert.x
Stars: ✭ 222 (+500%)
Mutual labels:  mock
Gripmock
gRPC Mock Server
Stars: ✭ 248 (+570.27%)
Mutual labels:  mock
Mockito Scala
Mockito for Scala language
Stars: ✭ 231 (+524.32%)
Mutual labels:  mock
Axios Mock Adapter
Axios adapter that allows to easily mock requests
Stars: ✭ 2,832 (+7554.05%)
Mutual labels:  mock
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+9218.92%)
Mutual labels:  mock

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();
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].