am trying to use sqlite in a windows runtime component. But I get some 219 errors when i add the nuget sqlite-net package. couldnt figure it out anywhere. Any similar issues ?
I finally used a store app class library to use sqlite and called those methods in it from my windows runtime component.
method in store app
public async Task<IEnumerable<TaskGroup> > GetTaskGroup()
{
return await conn.QueryAsync<TaskGroup>("select * from TaskGroup");
}
calling method in win runtime component
public IAsyncOperation<IEnumerable<TaskGroup>> GetAllTaskGroup()
{
return m_objDAL.GetTaskGroup().AsAsyncOperation();
}
i get the following error
Error 1 Method 'Tasker.BAL.TaskManager.GetAllTaskGroup()' has a parameter of type 'Windows.Foundation.IAsyncOperation<System.Collections.Generic.IEnumerable<SQLLite.Models.TaskGroup>>' in its signature. Although this generic type is not a valid Windows Runtime type, the type or its generic parameters implement interfaces that are valid Windows Runtime types. Consider changing the type 'SQLLite.Models.TaskGroup' in the method signature. It is not a valid Windows Runtime parameter type.
making the store app method as private resolves it as per this blog http://rarcher.azurewebsites.net/Post/PostContent/23
but i cant ue this since it will give me access issues since it is private.
any soln ?
I don't understand what these errors are, but did you first install the SQLite for Windows Runtime through Tools > Extensions? sqlite-net is LINQ query library
A Windows runtime component has many limitations regarding the types it exposes externally.
When you include
sqlite-net
, all its types are declared public and would effectively become exposed by the component. This is the reson for the errors you are seeing.You can do one of two things to resolve the problem:
public
modifiers inSQLite.cs
andSQLiteAsync.cs
files to internal. This will make it more difficult for you to update the package to a newer version since you'll have to repeat the process every time (a couple of minutes of work).sqlite-net
from there and reference this class library from your Windows runtime component. This waysqlite-net
's classes won't be automatically exposed by the component.