asynchronous - Xamarin.Forms using SQLite.Net.Async -
i have followed instructions here http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/databases/ - connect sqlite database synchronously.
public sqliteconnection getconnection() { var dbfilname = "localdb.db3"; string docspath = system.environment.getfolderpath(system.environment.specialfolder.personal); var path = path.combine(docspath, dbfilname); var plat = new sqliteplatformandroid(); var conn = new sqliteconnection(plat, path); return conn; }
i want change asynchronous connection (sqliteasyncconnection) can't work.
according instructions here - https://components.xamarin.com/gettingstarted/sqlite-net -it needs path parameter
var conn = new sqliteasyncconnection(path);
that doesn't work, error says parameters expected are:
a connection function, taskscheduler , taskcreationoptions
i have no idea , have not been able find examples work.
thanks in advance
you reuse getconnection method have , create async connection this:
var asyncdb = new sqliteasyncconnection(() => getconnection());
Comments
Post a Comment