C# 带有sqlite本地存储的Windows phone应用程序

C# 带有sqlite本地存储的Windows phone应用程序,c#,visual-studio,sqlite,windows-phone,sqlite-net-extensions,C#,Visual Studio,Sqlite,Windows Phone,Sqlite Net Extensions,我正试图用SQLite将我从JSON返回的对象保存到本地存储db中 我已经导入了很多包和SQLite框架 我还上了这两门课: 活动 public class Activity : INotifyPropertyChanged { [SQLite.PrimaryKey, SQLite.AutoIncrement] public int act_id { get; set; }

我正试图用
SQLite将我从
JSON
返回的对象保存到
本地存储
db中

我已经导入了很多包和SQLite框架

我还上了这两门课: 活动

public class Activity : INotifyPropertyChanged
    {
        [SQLite.PrimaryKey, SQLite.AutoIncrement]
        public int act_id
        {
            get;
            set;
        }
        //The Id property is marked as the Primary Key
        private int act_organization_id_value;
        private int act_creator_id_value;
        private int act_free_value;
        private int act_subcription_value;
        private int act_external_value;
        private int act_active_value;
        private int act_future_value;
        private int act_status_value;
        private int act_viewed_value;
        private string act_location_value = String.Empty;
        private string act_lng_value = String.Empty;
        private string act_title_value = String.Empty;
        private string act_information_value = String.Empty;
        private string act_type_value = String.Empty;
        private string act_color_value = String.Empty;
        private string act_event_identifier_value = String.Empty;
        private DateTime act_start_value = DateTime.Now;
        private DateTime act_end_value = DateTime.Now;

         [OneToMany(CascadeOperations = CascadeOperation.All)]
        public List<ActivityMember> membrs { get; set; }

       //Other getters and setters
}
一个活动可以有更多的活动成员。 当我构建并运行时,会出现以下错误:

调试时,我发现这是由以下几行引起的: 在活动中:

   [OneToMany(CascadeOperations = CascadeOperation.All)]
        public List<ActivityMember> membrs { get; set; }
有关于如何正确执行此操作的帮助吗

编辑 我有以下参考资料:


错误是由于SQLite.Net试图将类型为
的属性序列化到项目中,以强制库链接到您的SQLite Net版本

对编辑的响应

正如您在参考中所看到的,您有两个SQLite.Net库:

  • Net(及其异步API SQLite.Net.Async)
  • SQLite for Windows Phone

您必须删除对
SQLiteNetExtensions
SQLite.Net.Async
SQLite.Net.Async
的引用,并根据您的
SQLite For Windows Phone
库进行编译。

不确定这是否是相同的问题,但看起来可能是:@SebastianL是的,在同一平台上是相同的错误,这似乎是由同一个问题引起的。我能得到这些来源吗?我只是复制粘贴到我的解决方案?很抱歉,对于windows开发人员来说非常陌生。可能是个愚蠢的问题。但是,针对编译SQLite net Extensions源代码意味着什么呢?我的意思是,使用您在项目中使用的同一个SQLite.net依赖项从源代码重新编译SQLite net Extensions。最简单的方法是将源代码复制到您的项目中,这样您就可以强制库使用与您使用的相同的依赖项。所以我只是从源代码下载它,然后将现有项目添加到我的解决方案中?我是否需要添加SQLiteNetExtensions-MvvmCross.csproj或SQLiteNetExtensions PCL.csproj?只需将
属性
扩展
异常
文件夹的内容复制到项目中即可。
   [OneToMany(CascadeOperations = CascadeOperation.All)]
        public List<ActivityMember> membrs { get; set; }
  [ManyToOne]      // Many to one relationship with Activity
    public Activity activity { get; set; }