是否可以将带有连接结果的ExecuteStoreQuery映射到域对象?
即。我们有2个域对象
public class Customer
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
public virtual ICollection<Order> Orders { get; set; }
}
和
public class Order
{
public virtual int Id { get; set; }
public virtual string Description { get; set; }
public virtual int CustomerId { get; set; }
public virtual Customer Customer { get; set; }
}
现在如果我将运行此查询:
string query = "select * from Order as Order
inner join Customer as Customer on Order.CustomerId = Customer.Id
where freetext(Order.Description, 'something')";
_objectContext.ExecuteStoreQuery<Order>(query);
结果将是所有客户设置为null的订单集合。 我该如何解决这个问题?
谢谢!