{"action":"created","issue":{"url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/476","repository_url":"https://api.github.com/repos/praeclarum/sqlite-net","labels_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/476/labels{/name}","comments_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/476/comments","events_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/476/events","html_url":"https://github.com/praeclarum/sqlite-net/issues/476","id":191214142,"number":476,"title":"Add support to set SQLite3Provider","user":{"login":"lummoj","id":112391,"avatar_url":"https://avatars.githubusercontent.com/u/112391?v=3","gravatar_id":"","url":"https://api.github.com/users/lummoj","html_url":"https://github.com/lummoj","followers_url":"https://api.github.com/users/lummoj/followers","following_url":"https://api.github.com/users/lummoj/following{/other_user}","gists_url":"https://api.github.com/users/lummoj/gists{/gist_id}","starred_url":"https://api.github.com/users/lummoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lummoj/subscriptions","organizations_url":"https://api.github.com/users/lummoj/orgs","repos_url":"https://api.github.com/users/lummoj/repos","events_url":"https://api.github.com/users/lummoj/events{/privacy}","received_events_url":"https://api.github.com/users/lummoj/received_events","type":"User","site_admin":false},"labels":[{"id":8079944,"url":"https://api.github.com/repos/praeclarum/sqlite-net/labels/Feature","name":"Feature","color":"0b02e1","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-11-23T08:45:15Z","updated_at":"2016-11-24T01:53:02Z","closed_at":null,"body":"Is it possible to add support for choosing or manually setting the SQLite.raw provider? Rather than always calling SQLitePCL.Batteries.Init() in the SQLiteConnection static constructor.\r\n\r\nAs it stands I'm not able to use the sqlite-net-pcl NuGet package on a Raspberry Pi 3 using Mono out of the box as it requires a 32-bit Linux binary. \r\n\r\nIt works fine if I symbolically link libsqlite3.so to libe_sqlite3.so but what I'd really like to do is just use the SQLite3Provider_sqlite3 provider rather than SQLite3Provider_e_sqlite3 provider but this doesn't seem possible in the current version.\r\n\r\nPerhaps the SQLiteConnection could lazy initialize in the dynamic constructor with an additional constructor allowing the ISQLite3Provider to be passed in? I'm happy to make this change if you're interested."},"comment":{"url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/comments/262672271","html_url":"https://github.com/praeclarum/sqlite-net/issues/476#issuecomment-262672271","issue_url":"https://api.github.com/repos/praeclarum/sqlite-net/issues/476","id":262672271,"user":{"login":"lummoj","id":112391,"avatar_url":"https://avatars.githubusercontent.com/u/112391?v=3","gravatar_id":"","url":"https://api.github.com/users/lummoj","html_url":"https://github.com/lummoj","followers_url":"https://api.github.com/users/lummoj/followers","following_url":"https://api.github.com/users/lummoj/following{/other_user}","gists_url":"https://api.github.com/users/lummoj/gists{/gist_id}","starred_url":"https://api.github.com/users/lummoj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lummoj/subscriptions","organizations_url":"https://api.github.com/users/lummoj/orgs","repos_url":"https://api.github.com/users/lummoj/repos","events_url":"https://api.github.com/users/lummoj/events{/privacy}","received_events_url":"https://api.github.com/users/lummoj/received_events","type":"User","site_admin":false},"created_at":"2016-11-24T01:53:02Z","updated_at":"2016-11-24T01:53:02Z","body":"Thanks for the feedback Eric, I'll address your comments below:\r\n\r\n1. I think in this scenario it would be something along the lines of :\r\n`static bool _initialised = false;`\r\n`SQLiteConnection(string databasePath, ISQLiteProvider provider = null)\r\n{\r\nif(!_initialised) \r\n{\r\nif(provider == null)\r\n{\r\nBatteries.Init();\r\n}\r\nelse\r\n{\r\nSetProvider(provider)\r\n}\r\n_initialised = true\r\n}\r\n}`\r\nwhich should make the overhead relatively minimal. The downside is that each time you make the connection you'd have to pass in the provider and I'm not sure what the behaviour should be if the provider changes at some point which is probably where this idea breaks down. A new provider would have to be ignored (as above) as it would break any existing connections but this not particularly intuitive.\r\n\r\n2. In the 32-bit Linux scenario you get an exception when constructing SQLiteConnection for the first time (it is called in the static constructor) due to the missing e_sqlite3 library so there's no opportunity to call SetProvider afterwards unless you catch, SetProvider and construct again.\r\n\r\n3. This would certainly solve the particular issue that I encountered but I think changing providers or batteries is the way to go in a more general sense.\r\n\r\n4. This definitely makes sense and I certainly agree with that approach. I think changing the provider should be the exception not the rule.\r\n\r\n5. This would help especially as you already have an SQLCipher bundle but I think there is still a use case for other configurations such as using the operating system libraries."}}
{"actor":{"display_login":"lummoj"}}