New features in Dapper.Contrib

I’ve given the official Dapper.Contrip package some love lately. So now all methods include support for lists! So instead of doing lots of insert calls in a loop, just call connection.Insert(myList); and Dapper/Contrib will interate and insert your entities effectively and fast!

Dapper.Contrib now contains these methods:

T Get<T>(id);
IEnumerable<T> GetAll<T>();
int Insert<T>(T obj);
int Insert<T>(IEnumerable<T> list);
bool Update<T>(T obj);
bool Update<T>(IEnumerable<T> list);
bool Delete<T>(T obj);
bool Delete<T>(IEnumerable<T> list);
bool DeleteAll<T>();

For .NET 4.5 users there are also async methods available. For a complete and (almost) up-to-date help page on how Dapper.Contrib works, please visit https://github.com/StackExchange/dapper-dot-net/tree/master/Dapper.Contrib

Dapper.Contrib can be installed from Nuget, read more at https://www.nuget.org/packages/Dapper.Contrib/

2 Comments

  • The dapper is very good!
    but it have a bug when it used in DB2!
    such as insert when i use Parameter,it will throw a exception

  • HI, Johan.
    Would you please check on this fix: https://github.com/StackExchange/dapper-dot-net/pull/258
    It's really big deal for us to overwrite the internal IEnumerable Type Handler.
    I need to implement JSON list/dictionary in my app... Need that badly....
    Thanks

Comments have been disabled for this content.