问题
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