"Mattias Sjögren" <ma********************@mvps.org> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
ask is if there was
a way to tell reflection that a read-only property maps to some private
field within that class,
No
so that
I could set the "property value" with reflection, but not allow the user
ofmy class to do the same from code.
Why do you want to do it with reflection? Couldn't you just provide an
internal method to set the value?
Hi Mattias,
Thanks for your reply.
I can't just use an internal method because I do not know what properties
will the class contain.
The user developer creates the class and my O/R tool fills its properties
with data from database fields based on a XML mapping file (via reflection).
Along with the mappings to real database fields, the mappings can include
"virtual" fields which therefore cannot be updated, so it seems logical not
to allow the developer to modify its associated property.
I have solved this design demand by requiring that a private field with the
same name as the read-only property exists, so that it could be filled with
data.
Regards
--
Bartol
--
Remove "TB" from address to reply