I have been getting this error literally for years using NHibernate:
NHibernate.HibernateException: Creating a proxy instance failed
I get this typically when I have some work in my constructor like so:
public UserAccount()
{
this.CreditCard = new CreditCard();
this.Addresses = new Dictionary<AddressType, Address>();
var primary = new Address(AddressType.Primary);
var billing = new Address(AddressType.Billing);
this.Addresses.Add(AddressType.Primary, primary);
this.Addresses.Add(AddressType.Billing, billing);
}
When NHibernate creats the proxy, it seems like my Addresses property
is getting overridden so that its always null, so that when it gets to
the line where I'm adding addresses, I get null reference exception
even though I just set it in the previous line.
Can anyone tell me why NHibnerate/Dynamic proxy works this way and
what the recommended practice around it is? I know I can just do a
null check on addresses but that seems so non-intuitive.
Thanks,
Craig
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---