Hi Kristoffer, Yes, but I would prefer not to as I want to preserve encapsulation between classes and their bases.
Regards, mal ---- Kristoffer Sheather <[EMAIL PROTECTED]> wrote: > Expose the private members as protected or internal properties, problem > solved. > > Thanks, > Kris. > > -----Original Message----- > From: Unmoderated discussion of advanced .NET topics. > [mailto:[EMAIL PROTECTED] On Behalf Of Malcolm Young > Sent: Tuesday, 23 August 2005 9:48 > To: [email protected] > Subject: [ADVANCED-DOTNET] Using Reflection to Obtain Private Members of > Base Classes > > > Hi All, > > We have developed an OR mapping tool in house. Fields and properties are > marked up with attributes that describe the mappings. In order to > preserve encapsulation, these fields may be private. When it's time to > hydrate or persist the object, the mappings are used to gain access to > each field. > > This works fine except when inheritance comes in to the picture. Classes > that derive from other classes obviously can't reflect on their bases > private members. If the persistence code was manually coded this > wouldn't be a problem as we could just call a virtual method that could > call it's base however I am trying to perform the hydration, > serialisation on the basis of metadata. > > So far we ahve worked around this by making all the members of the base > class protected but it's a pretty crappy solution. So I guess my > question is: 'Can I use reflection to gain a reference to a base classes > private members?'. > > Thanks Guys, > > mal > > =================================== > This list is hosted by DevelopMentor http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > > Notice: > The information contained in this e-mail message and any attached files may > be confidential information, and may also be the subject of legal > professional privilege. If you are not the intended recipient any use, > disclosure or copying of this e-mail is unauthorised. If you have received > this e-mail in error, please notify the sender immediately by reply e-mail > and delete all copies of this transmission together with any attachments. > > =================================== > This list is hosted by DevelopMentor® http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor� http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
