利用此处的代码,我将其添加到 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 构造函数提供所谓的全局数据库路径?