7
dapper.net – Quick start

Dapper.net - Quick Start

Embed Size (px)

Citation preview

Page 1: Dapper.net - Quick Start

dapper.net – Quick start

Page 2: Dapper.net - Quick Start

What is dapper.net?

• Simple SQL object mapper for ADO.NET

• Open source - Apache License 2.0 -https://github.com/StackExchange/dapper-dot-net

• From Stack Exchange Team – dapper in production use @StackOverflow

Page 3: Dapper.net - Quick Start

How it works?

• Extension methods on top of IDbConnection interface.

• You require an instance of IDbConnection implementation, it works with any DB provider - Sqlite, Sqlce, firebird, oracle, MySQL, PostgreSQL and SQL Server

Page 4: Dapper.net - Quick Start

How can I get it?

• Download and build from GitHub -https://github.com/StackExchange/dapper-dot-net

• Copy the single SqlMapper.cs file from GitHub and include it in your project.

• Via NuGet – Install-Package Dapper

Page 5: Dapper.net - Quick Start

Why dapper?

Performance of SELECT mapping over 500 iterations - POCO serialization – Source github

Method Duration

Hand coded (using a SqlDataReader) 47ms

Dapper ExecuteMapperQuery 49ms

ServiceStack.OrmLite(QueryById) 50ms

PetaPoco 52ms

BLToolkit 80ms

SubSonic CodingHorror 107ms

NHibernate SQL 104ms

Linq 2 SQL ExecuteQuery 181ms

Entity framework ExecuteStoreQuery 631ms

Page 6: Dapper.net - Quick Start

Demo

Page 7: Dapper.net - Quick Start

Questions?

• Further reading – Kill your ORM

Thank you