a) test case would be nice
b) NH doesn't make a distinction between properties and their declaration
order. That means that it get calls GetProperty("Name") and use whatever
comes.
In the scenario that you describe, I don't think it is documented what will
be the order to return that.
c) simplest option, add another property with different name.

On Tue, Sep 9, 2008 at 11:39 PM, Will Shaver <[EMAIL PROTECTED]> wrote:

> I've asked similar questions in the past but haven't gotten any concrete
> answers, and I'm hitting this over and over. I've tried a ton of different
> options, and would be willing to create a separate solution to show others
> what the problem is. Last time I asked it as doughnut classes and we got off
> on a tangent and didn't solve it... so I'll avoid that this time.
>
> Say I've got some Products, here's the four classes:
>
> Product
> ProductData
>
> SpecialProduct : Product
> SpecialProductData : ProductData
>
> Product has a bag of ProductData
> SpecialProduct has a bag of SpecialProductData
>
> In the ProductData class I want a property called "Parent" that points to
> the Product:
> public virtual Product Parent {get;set;}
>
> In the SpecialProductData class I want that same Parent property to instead
> point to the SpecialProductData
> public new virtual SpecialProduct Parent { get;set;}
>
> I've tried defining the Parent property only in the base class and in both
> classes. I've tried referencing the base class inside the inherited class
> (get{ return base.Parent;}) instead of an automatic property. If I define it
> only in the base class hbm and I load a SpecialProductData as ProductData it
> will SOMETIMES error out as:
>
> [NHibernate.PropertyAccessException] = {"Invalid Cast (check your mapping
> for property type mismatches); setter of
> Domain.Entities.SpecialProductData"}
>
> But only sometimes! Seriously, I can run this same code 10 times and it
> will error about 50% of the time. Driving me crazy. Any recommendations?
> Seems that someone should have tackled an inheritance model like this one.
>
>  -Will
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to