从多个 IRepository 获取结果 [英] Fetching results from more than one IRepository
本文介绍了从多个 IRepository 获取结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用户和订单列表.
I have a list of Users and Orders.
public class UserRecord
{
public virtual int UserId { get; set; }
public virtual string Name { get; set; }
}
public class OrderRecord
{
public virtual int UserId { get; set; }
public virtual int OrderId { get; set; }
}
我有两个存储库 - IRepository 和 IRepository.我怎样才能像这样加入两者并获取结果?
I have two repositories - IRepository and IRepository. How can I join the two and fetch the result, like this?
SELECT UserRecord.UserId, Name, OrderId从用户记录,订单记录WHERE UserRecord.UserId = OrderRecord.UserId
SELECT UserRecord.UserId, Name, OrderId FROM UserRecord, OrderRecord WHERE UserRecord.UserId = OrderRecord.UserId
谢谢.
推荐答案
改用 ContentManager 上的 HQL API.Repository 用于对单个表进行简单的 CRUD 操作.
Use the HQL API that is on ContentManager instead. Repository is for simple CRUD operations on a single table.
这篇关于从多个 IRepository 获取结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文