Entity framework Breeze/Entity Framework:将对象添加到多个集合时,仅返回一个集合?

Entity framework Breeze/Entity Framework:将对象添加到多个集合时,仅返回一个集合?,entity-framework,breeze,Entity Framework,Breeze,我不确定这是微风问题还是EF问题,但EF中的表在我看来很好 我有一个交易账户,跟踪所有交易和持有情况。控股还包含关联交易的集合。因此,一个事务可以添加到两个集合中 以下是我的相关课程: public class TradingAccount { public int Id { get; set; } public string Name { get; set; } public ICollection<Transaction> Transactions {

我不确定这是微风问题还是EF问题,但EF中的表在我看来很好

我有一个
交易账户
,跟踪所有交易和持有情况。控股还包含关联交易的集合。因此,一个事务可以添加到两个集合中

以下是我的相关课程:

public class TradingAccount
{
    public int Id { get; set; }
    public string Name { get; set; }

    public ICollection<Transaction> Transactions { get; set; }
    public ICollection<Holding> Holdings { get; set; }
}

public class Transaction
{
    public int Id { get; set; }
    public int AccountId { get; set; }
    public Account Account { get; set; }
}

public class Holding
{
    public int Id { get; set; }
    public int AccountId { get; set; }
    public Account Account { get; set; }

    public ICollection<Transaction> Transactions { get; set; }
}
问题是,当我向TradingAccount.Transactions和Holding.Transactions添加事务时,仅Holding.Transactions返回值,TradingAccount.Transactions不返回值


是否我做错了什么?

要确定问题出在哪里,请监视OData请求和响应。要做到这一点,您可以使用Fiddler,或者根据浏览器的不同,点击F12,然后查看您的浏览器是否允许您监控请求和响应(例如,在Chrome中有一个“网络”窗格)。这里有些东西不太连接。实际上,我希望Holding.Transactions不会返回任何内容,因为我没有看到
Transaction
具有
HoldingId
外键和
Holding
导航属性。另外,账户和交易账户之间的关系是什么?
Context.TradingAccounts.Include("Transactions")
                       .Include("Holdings")
                       .Include("Holdings.Transactions")
                       .Where(t => t.Id == id);