【发布时间】:2014-10-18 00:02:16
【问题描述】:
利用代码 here,我将其添加到 App.xaml.cs:
sealed partial class App : Application
{
public string DBPath { get; set; }
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
. . .
this.DBPath = Path.Combine(
Windows.Storage.ApplicationData.Current.LocalFolder.Path, "photrax.sqlite");
. . .
...但是这段代码:
internal static List<PhotraxBaseData> SavePhotoset(List<PhotraxExifData> exifData)
{
using (var db = new SQLite.SQLiteConnection(App.DBPath))
. . .
...失败,“非静态字段、方法或属性 'Photrax.App.DBPath.get' 需要对象引用”
Photrax 是我项目的命名空间;但是附加的“get”爵士乐是怎么回事?
我需要做什么来为 SQLiteConnection 构造函数提供所谓的全局 db 路径?
【问题讨论】:
-
请尝试搜索错误消息。
标签: c# sqlite windows-store-apps app.xaml