如何使用SQLite在Windows(手机)8.1的BackgroundTask [英] How to use SQLite in Windows (Phone) 8.1's BackgroundTask

查看:177
本文介绍了如何使用SQLite在Windows(手机)8.1的BackgroundTask的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟着通用的应用程序使用SQLite例如 以添加的SQLite 来我的项目;然后添加 BackgroundTask 我跟着快速入门:创建并注册一个后台任务的例子

I followed Universal App with SQLite example to add SQLite to my project; then to add the BackgroundTask I followed Quickstart: Create and register a background task example.


  1. SQLite的目标为的Windows Phone 8.1 的Windows 8.1

BackgroundTask 目标只有窗口(是一个 Windows运行时组件

这是它变得棘手。

您不能引用与 BakgroundTask 不是的移动的,因而项目我不能添加 SQLite,让Windows运行时(Windows 8.1中)或< A HREF =htt​​ps://visualstudiogallery.msdn.microsoft.com/5d97faf6-39e3-4048-a0bc-adde2af75d1b相对=nofollow> SQLite,让Windows Phone的8.1 ​​到 BackgroundTask 项目。

You cannot reference a project with the BakgroundTask that isn't portable, thus I cannot add SQLite for Windows Runtime (Windows 8.1) or SQLite for Windows Phone 8.1 to the BackgroundTask project.

反正是有使用 SQLite的 BackgroundTask ?

推荐答案

有时候答案更容易超出预期。

Sometimes the answer is easier than expected.


  1. 设置后台任务的库目标只面向Windows(手机)8.1

  2. 创建一个类库的目标仅适用于Windows (手机)8.1

  3. 添加的SQLite的Windows(手机)8.1到类库

  4. 引用类库通过后台任务

  1. Set the Background Task's Library Target to only target Windows (Phone) 8.1
  2. Create a Class Library that targets only Windows (Phone) 8.1
  3. Add SQLite for Windows (Phone) 8.1 to the Class Library
  4. Reference the Class Library with the Background Task

这就是它!

完成大部分在类库的工作,只进行从后台任务调用,这使得BGT看起来更干净。有关使用的好处一个类库是,你可以使用泛型。

Do most of the work in the Class Library and only make calls from the Background task, this makes the BGT look cleaner. The nice thing about using a Class Library is that you can use generics.

您将有2个后台任务您普遍的应用程序

You will have 2 Background Tasks for your universal app


  • Windows 8.1中后台任务

  • 的Windows Phone 8.1后台任务

这篇关于如何使用SQLite在Windows(手机)8.1的BackgroundTask的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆