源码中的窗口运行时组件(sqlite in windows runtime component)

2019-08-18 00:30发布

我试图在Windows运行时组件使用SQLite。 但是,我得到一些219错误,当我加入的NuGet sqlite的网包。 想不出弄明白任何地方。 任何类似的问题?

我终于用一个商店应用类库使用SQLite,并呼吁从我的Windows运行时组件在它的方法。

方法商店应用

   public async  Task<IEnumerable<TaskGroup> > GetTaskGroup()
    {
         return await conn.QueryAsync<TaskGroup>("select * from TaskGroup");

    }

在Win运行时组件的方法调用

public IAsyncOperation<IEnumerable<TaskGroup>> GetAllTaskGroup()
    {
        return m_objDAL.GetTaskGroup().AsAsyncOperation();

    }

我得到以下错误

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.   

使得商店应用方法为私有解决它按这个博客http://rarcher.azurewebsites.net/Post/PostContent/23

但我不能UE这一点,因为它会给我访问问题,因为它是私有的。

任何SOLN?

Answer 1:

我不明白这些错误,但你第一次安装通过工具>扩展为Windows运行时SQLite的? 源码网是LINQ查询库



Answer 2:

一个Windows运行时组件有很大的局限性有关它的外部呈现的类型。

如果包括sqlite-net ,它的所有类型声明公共和将有效地成为由组件暴露出来。 这是您所看到的错误振振有辞。

你可以做的两件事情来解决此问题之一:

  • 你可以改变所有public的修饰SQLite.csSQLiteAsync.cs文件内。 这将使其更难以为你的包更新到新版本,因为你必须每次(一对夫妇的工作分钟),重复这个过程。
  • 您可以创建一个单独的Windows Store应用程序类库,参考sqlite-net从那里,并从你的Windows运行时组件引用这个类库。 这样sqlite-net的类不会被自动部件外露。


文章来源: sqlite in windows runtime component