我对 SQLite-Net 有疑问我有三个类:ClassA、ClassB、ClassC。ClassA 与 ClassB 具有 OneToMany 关系。ClassB 与 ClassC 具有多对一关系。
这是我的代码
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
using WardFlex.Core.DAL.Interfaces;
public class ClassA : IEntity
{
[XmlAttribute("Id")]
[PrimaryKey, AutoIncrement]
public Int64 Id { get; set; }
public string Kaka { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<ClassB> ClassBs { get; set; }
}
public class ClassB : IEntity
{
[XmlAttribute("Id")]
[PrimaryKey, AutoIncrement]
public Int64 Id { get; set; }
[ForeignKey(typeof(ClassA))]
public Int64 ClassAId { get; set; }
[ManyToOne]
public ClassA ClassA { get; set; }
[ForeignKey(typeof(ClassC))]
public Int64 ClassCId { get; set; }
[ManyToOne]
public ClassC ClassC { get; set; }
}
public class ClassC : IEntity
{
[XmlAttribute("Id")]
[PrimaryKey, AutoIncrement]
public Int64 Id { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<ClassB> ClassBs { get; set; }
}
我保存了 ClassA 实体,但是当我尝试从 ClassARepository 获取 GetAllWithChildren 时,我看不到 ClassB 中的 classC 实体(已附加图像) 在此处输入图像描述
可能是什么问题呢??
先感谢您