1
我有这样的SQL查询:SQL查询加入NHibernate的与QueryOver
select pr.*, det.Description, det.Name
from Product pr
inner join ProductDetail det on det.Product_id = pr.id
where pr.Id = XX and det.IsDefault = yy
我怎样才能做到这一点与QueryOver?
感谢,
更新: “公关*”
public ProductMap()
{
Id(x => x.Id).GeneratedBy.Native();
Map(x => x.Code)
.Length(20)
.Not.Nullable();
Map(x => x.CreationDate).Not.Nullable();
Map(x => x.IsDeleted);
Map(x => x.Price);
HasManyToMany(x => x.Categories)
.AsSet()
.Cascade
.SaveUpdate()
.Table("ProductsCategories");
}
public class ProductDetailMap : ClassMap<ProductDetail>
{
public ProductDetailMap()
{
Id(x => x.Id).GeneratedBy.Native();
Map(x => x.Name)
.Length(50)
.Not.Nullable();
Map(x => x.Description)
.Length(250);
Map(x => x.IsDefault);
References(x => x.Language);
References(x => x.Product);
}
}
什么类型你想出去吗? – 2012-07-18 22:32:09
@AndrewWhitaker匿名类型。 – 2012-07-19 03:42:08