I am not sure I would use inheritance to compose data? I really dislike down casts.
Anyway I don't know enough about NH proxies, and how they supports down casts? But I believe you can find something in the NHibernateUtil utility class to initialize away the proxy... /M >-----Original Message----- >From: [email protected] [mailto:[email protected]] On Behalf >Of Victor Rosenberg >Sent: Thursday, October 01, 2009 9:20 PM >To: nhusers >Subject: [nhusers] Re: Polymorphic vs Proxies vs Design > > >Thanks for the answer. >I wasn't aware of this principle until now, and it does sound good, >but I am afraid its not the case in my situation. The principal refers >to a functionality (if I get it correct), but my classes don't have >any. They're just holding information so far. For instance, my >AbstractAccuracy defines some integer and double properties, and the >Accuracy that derives from it defines some more properties. The >classes are simply a metadata. >Any ideas? > >Vic > > >On Sep 30, 12:32 pm, "Morten Maxild" <[email protected]> wrote: >> Look up 'Liskov Substitution Principle', and you will see what they mean. >> >> Its can be found using Google, or often in the .NET world as one of the >SOLID principles, as described by Uncle Bob. >> >> /M >> >> >-----Original Message----- >> >From: [email protected] [mailto:[email protected]] On >Behalf >> >Of Victor Rosenberg >> >Sent: Wednesday, September 30, 2009 10:22 AM >> >To: nhusers >> >Subject: [nhusers] Polymorphic vs Proxies vsDesign >> >> >Hey everybody >> >I have a class - lets call it AbstractAccuracy that has about 5 >> >different classes deriving from it, one of them is called Accuracy. >> >One of my other classes has an AbstractAccuracy property. >> >Now, everything's fine, when I load the class, the property holds a >> >reference to a AbstractAccuracyProxy and I am fine with that. The >> >question is what do I do with it, because it is not castable to the >> >Accuracy class that I actually need... And I don't even know what >> >derived class do I have in my hands... >> >I can disable lazy loading, I can use eager loading, but isn't there >> >some other better solution? >> >> >In the NHibernate in action book, on a page 202 that addresses this >> >issue, and it says "Truly object oriented code shouldnt use is or >> >numerous typecasts. If you find yourself running into problems with >> >proxiesm you should question yourdesign, asking whether there is a >> >more polymorphic approach". What do they mean? >> >> >Thanks in advance >> >Victor > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
