hi
i been strugling with this for 2days 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 dont get no Id rightaway. 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.
Code:
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 do fluent nhibernate on the mapping but i have had it looked at and it dont seem to be the problem.
Quote:
Id(x => x.Id, "Id").GeneratedBy.Identity().WithUnsavedValue(default(int));
Map(x => x.Name);
Map(x => x.CreateDate);
Map(x => x.Active);
Map(x => x.OrgNumber);
Map(x => x.Email);
HasMany<CustomerPhone>(x => x.CustomerPhones).IsInverse().Cascade.All().LazyLoad();
if you got any thoughts on this please write cause this is causing big problems for me.