lundi 29 février 2016

specify a data provider with xamarin ios c# for microlite orm

I am trying to use Microlite orm to connect to a sqlite db in my xamarin ios project. Microlite needs a sessionfactory to be defined which I am trying to do like this

_sessionFactory =
                    Configure.Fluently()
                        .ForSQLiteConnection("localSqlLite", connString, "System.Data.SQLite")
                        .CreateSessionFactory();

However I get the error that "Unable to find the requested .Net Framework Data Provider. It may not be installed." MicroLite needs the sqlite data provider be registered which normally you would do in web / app.config like this

<system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data   Provider for SQLite"
      type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>

However because it is an ios project with xamarin I do not have any type of config. Has anyone found a way to work around this? I can't find a way to define a data provider at runtime if that would even work.

Aucun commentaire:

Enregistrer un commentaire