Skip to content

Using Catnap With MonoTouch

Tim Scott edited this page Dec 29, 2015 · 8 revisions

Using Catnap With MonoTouch

Mono.Data.Sqlite

In the configuration example in the Introduction, we pass a SqliteAdapter into the SessionFactory. Among other things, this tells Catnap to find System.Data.Sqlite.dll in the bin folder. If you are using Mono.Data.Sqlite.dll you must tell the adapter the type of the connection, like so:

var monoSqliteAdapter = new SqliteAdapter(typeof(Mono.Data.Sqlite.SqliteConnection));
var sessionFactory = Fluently.Configure
    ...
    .DatabaseAdapter(monoSqliteAdapter)
    ...;

Couldn't we just add MonoSqliteAdapter to Catnap? We could but it won't work on iOS devices. MonoTouch, it seems, is not quite able to dynamically load a type at runtime. It throws a TypeLoadException.

Clone this wiki locally