Skip to content

Instantly share code, notes, and snippets.

@valeriob
Created November 17, 2012 01:01
Show Gist options
  • Save valeriob/4092323 to your computer and use it in GitHub Desktop.
Save valeriob/4092323 to your computer and use it in GitHub Desktop.
OrmLite Insert Update extensions
public static class OrmLite_Extensions
{
public static void Insert2<T>(this IDbConnection dbConn, params T[] objs)
where T : new()
{
foreach (var obj in objs)
dbConn.Exec(dbCmd => OrmLiteConfig.DialectProvider.CreateParameterizedInsertStatement(obj, dbConn).ExecuteNonQuery() );
}
public static void Update2<T>(this IDbConnection dbConn, params T[] objs)
where T : new()
{
foreach (var obj in objs)
dbConn.Exec(dbCmd => OrmLiteConfig.DialectProvider.CreateParameterizedUpdateStatement(obj, dbConn).ExecuteNonQuery() );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment