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.

Reply via email to