I've been struggling with this for 2 days now so i thought i would give it a shot here.
my scenario looks like this. i got a Customer and CustomerPhone. Now i save the Customer and CustomerPhone at the same time but the CustomerPhone doesn't get Id right away. but if i do a redirect to a other site and get the Customer object there the CustomerPhone will have a Id.
my code for the the classes look like this.
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
public virtual string OrgNumber { get; set; }
public virtual DateTime? CreateDate { get; set; }
public virtual bool Active { get; set; }
public virtual string Email { get; set; }
public virtual IList<CustomerPhone> CustomerPhones { get; set; }
public Customer()
{
CustomerPhones = new List<CustomerPhone>();
}
public virtual void AddCustomerPhones(CustomerPhone customerPhone)
{
customerPhone.Customer = this;
CustomerPhones.Add(customerPhone);
}
I use fluent nhibernate for the mapping, but I have had it looked at and it doesn't seem to be the problem.
If you have any thoughts on this please write because this is causing big problems for me.