Skip to content

Instantly share code, notes, and snippets.

@mythz
Created June 17, 2011 01:59
Show Gist options
  • Save mythz/1030717 to your computer and use it in GitHub Desktop.
Save mythz/1030717 to your computer and use it in GitHub Desktop.
Shorthand OrmLite db access with IDbConnectionFactory extension methods
IDbConnectionFactory dbFactory = new OrmLiteConnectionFactory("...",
SqlServerOrmLiteDialectProvider.Instance);
Author author = dbFactory.Exec(dbCmd => dbCmd.GetById<Author>(1));
List<Author> rows = dbFactory.Exec(dbCmd =>
dbCmd.Select<Author>("Username LIKE {0}", "%example.com"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment