Fetching results from more than one IRepository

纵饮孤独 提交于 2020-01-15 05:24:13

问题


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; }
}

I have two repositories - IRepository and IRepository. How can I join the two and fetch the result, like this?

SELECT UserRecord.UserId, Name, OrderId FROM UserRecord, OrderRecord WHERE UserRecord.UserId = OrderRecord.UserId

Thanks.


回答1:


Use the HQL API that is on ContentManager instead. Repository is for simple CRUD operations on a single table.



来源:https://stackoverflow.com/questions/10423564/fetching-results-from-more-than-one-irepository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!