您可以在标题中看到错误。 有我的表类:
public class Cars : Table
{
[NotNull]
public string name { get; set; }
[ForeignKey(typeof(Models)), NotNull]
public int model_out_id { get; set; }
[ForeignKey(typeof(Bodies)), NotNull]
public int body_out_id { get; set; }
[MaxLength(50)]
public string vin { get; set; }
[MaxLength(4), NotNull]
public int year { get; set; }
[Indexed, NotNull]
public long created_at { get; set; } = DateTime.Now.GetTimestamp();
[ManyToOne(CascadeOperations = CascadeOperation.CascadeRead)]
public Models Model { get; set; }
[ManyToOne(CascadeOperations = CascadeOperation.CascadeRead)]
public Bodies Body { get; set; }
[OneToMany]
public List<CarGlasses> CarGlasses { get; set; }
public Cars()
{
}
}
public class Models : TableLibrary
{
[PrimaryKey, NotNull]
public int out_id { get; set; }
[NotNull]
public string name { get; set; }
[ForeignKey(typeof(Marks)), NotNull]
public int mark_out_id { get; set; }
[Indexed, NotNull]
public int year_from { get; set; }
[Indexed]
public int? year_to { get; set; }
[ManyToOne(CascadeOperations = CascadeOperation.CascadeRead), Ignore]
public Marks Mark { get; set; }
public Models()
{
}
}
此处出现错误:
inst.GetChild(car, "Model");
inst
是SQLite.Net.SQLiteConnection
个实例
当我使用库作为普通代码时,一切正常,但现在我将其添加为PCL引用。正如您所见,Models
表中存在PrimaryKey。这段代码有什么问题?
答案 0 :(得分:0)
这是我在xamarin论坛上的帖子。我在那里有解决方案。