Fredrick Lackey - 263 - May 30, 2014

Looking for a recommendation for easily switching between a per-call and per-lifetime option for the IDbConnection used within OrmLite.  I am currently using a repository pattern (one repo for each data type) and a Utility class for creating/seeding tables.  It would be great to be able to reuse the same repositories in multiple areas an the application where the lifetime of the connection is different.  At the moment each of my Utility classes take a custom IPersistenceModel object however I would love for something like this to be included in the OrmLiteConnectionFactory.

You can reduce a lot of the boiler plate with DataAware services by inheriting from a base class like RepositoryBase:
Dependencies are injected with the safe IDbConnectionFactory whilst it reduces boilerplate as it lets you access the DB connection with base.Db.