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