OneToMany
I'm having problems with a HasMany relationship, the things is I have a Customer who has a credit card and a Wishlist and also Orders, if I do
Customer.Orders : works ok
Customer.Wishlist: works ok
Customer.CreditCard: it is null, and there is data in the database
This is the mapping class
public partial class CustomerMap:ClassMap
{
public CustomerMap()
{
Id(x => x.Id).Column("CustID");
Map(x => x.FirstName);
Map(x => x.MiddleInitial);
Map(x => x.LastName);
HasOne(x => x.Wishlist)
.LazyLoad()
.ForeignKey("CustID")
.Cascade.All();
HasOne(x => x.CreditCard)
.ForeignKey("CustID")
.LazyLoad()
.Cascade.All();
HasMany(x => x.Orders)
.LazyLoad()
.KeyColumn("CustID");
}
And this is the entity
public partial class Customer
{
public virtual CustomerCreditCard CreditCard { get; set; }
public virtual IList<Order> Orders { get; set; }
public virtual Wishlist Wishlist { get; set; }
}
What i'm doing wrong? Is there any way to show debug info? or get some help to find the problem?
Thanks a lot!
Comments are currently closed for this discussion. You can start a new one.
Support Staff 2 Posted by Hudson Akridge on 02 Mar, 2010 05:06 PM
Closing as a dupe.
Hudson Akridge resolved this discussion on 02 Mar, 2010 05:06 PM.