【发布时间】:2016-12-15 16:41:40
【问题描述】:
我有一个包含四个表的实体框架模型,我们这里唯一需要关注的两个是 [AtmAccounts] 和 [Transactions]。 [AtmAccounts] 具有以下属性:[Id -Primary Key]、[AccountNumber]、[AccountBalance]、[UserId] 和 [AccTypeId]。 Transactions 具有以下内容:[Id- Primary Key]、[TransAmount]、[TransDate]、[AtmAccountId - Navigation Property] 和 [TransTypeId]。
我想获取特定帐户的交易列表并将其显示在屏幕上。为此,我需要从事务表中获取与存储在 AtmAccounts 中的 AtmAccountId 相对应的所有记录。我该怎么做?
【问题讨论】:
-
db.Transactions.Where(s=>s.AtmAccountId==someAccountId")? -
@JayRoberts 对你有用吗?
标签: sql asp.net-mvc entity-framework