Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect to sqlite database from Windows Runtime Component which is for running Background tasks

I am having trouble connecting to sqlite database from Windows Runtime Component which is for running Background tasks.. I am including all the dll required the same way I added for the main project.. But it doesn’t work.. Shows some 200 errors.. I followed this post :https://github.com/praeclarum/sqlite-net/issues/104
But still I get errors.. 2 such errors are:

Error 2 Windows Runtime class 'SQLite.SQLiteException' has an invalid base type 'System.Exception'. Exporting custom exception types is not allowed. D:\MCM-22-Jan-2013\CCM\TileBackground\SQLite.cs 46 15 TileBackground

Error 92 Type 'SQLite.TableMapping.Column' is a nested type. Nested types cannot be exported to the Windows Runtime. D:\MCM-22-Jan-2013\CCM\TileBackground\SQLite.cs 1390 16 TileBackground

like image 993
Dixit Gokhale Avatar asked Oct 21 '22 17:10

Dixit Gokhale


1 Answers

I encountered this problem today, and with the help of https://github.com/praeclarum/sqlite-net/issues/104 I'm able to solve it. Basically you have 2 things to do after sqlite-net of nuget is setup.

  1. You need to change all public of class definition (5th column) to internal, for SQLite.cs and SQLiteAsync.cs
  2. You need to change namespace SQLite to whatever namespace your C# project is using.

This way, this wrapper become part of your C# component / Windows Runtime Component, and it's not exported.

like image 92
He Shiming Avatar answered Nov 01 '22 09:11

He Shiming