我正在尝试将我从我JSON
的数据库中返回的对象保存到local storage
数据库中SQLite
我已经导入了很多包以及 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
}
活动成员
public class ActivityMember : INotifyPropertyChanged
{
[SQLite.PrimaryKey, SQLite.AutoIncrement]
public int mem_id
{
get;
set;
}
private int mem_activity_id_value;
private int mem_organization_id_value;
private int mem_role_id_value;
private int mem_creator_value;
private int mem_accepted_value;
private int mem_activity_accepted_value;
private int mem_active_value;
private int mem_deleted_value;
private string mem_profile_color_value = String.Empty;
private string mem_picture_value = String.Empty;
private string mem_email_value = String.Empty;
private string mem_phone_value = String.Empty;
private string mem_gsm_value = String.Empty;
private string mem_address_value = String.Empty;
private string mem_postal_value = String.Empty;
private string mem_city_value = String.Empty;
private string mem_country_id_value = String.Empty;
private string mem_first_name_value = String.Empty;
private string mem_last_name_value = String.Empty;
private string mem_extra_info_value = String.Empty;
private string mem_street_value = String.Empty;
private string mem_streetnumber_value = String.Empty;
private string mem_gender_value = String.Empty;
private DateTime mem_birthdate_value = DateTime.Now;
[ManyToOne] // Many to one relationship with Activity
public Activity activity { get; set; }
// all other getters and setters
}
一个活动可以有更多的活动成员。当我构建并运行时,我收到以下错误:
当我调试时,我发现它是由以下几行引起的:在活动中:
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<ActivityMember> membrs { get; set; }
在活动成员中:
[ManyToOne] // Many to one relationship with Activity
public Activity activity { get; set; }
关于如何正确执行此操作的任何帮助?
编辑 我有这些参考: