Take a look at http://nhforge.org/doc/nh/en/index.html#queryqueryover-projections, in particular the AliasToBean<T> transformer is probably what you're after.
Pete From: [email protected] [mailto:[email protected]] On Behalf Of Christian I. Sent: 27 September 2012 21:10 To: [email protected] Subject: [nhusers] Join between tables and result to another class Hello, I have this mapping (see below). I'd create a List<MyClass> with some properties of Product and other of ProductDetail. How can I do this ? Thanks, public class MyClass { public string FieldA { get; set; } public string FieldB { get; set; } public string BieldC { get; set; } public string BieldD { get; set; } } Mappging : public class ProductMap : ClassMap<Product> { public ProductMap() { Id(x => x.Id).GeneratedBy.Native(); Map(x => x.Code) .Length(20) .Unique() .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"); HasManyToMany(x => x.Details) .AsSet() .Cascade .SaveUpdate() .Table("ProductsProductsDetails"); } } 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); HasManyToMany(x => x.Products) .AsSet() .Inverse() .Table("ProductsProductsDetails"); } } -- You received this message because you are subscribed to the Google Groups "nhusers" group. To view this discussion on the web visit https://groups.google.com/d/msg/nhusers/-/qQa2M-KllyYJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
