Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preventng direct creation of sub-class instances
Message
From
28/07/2006 11:53:49
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01141060
Message ID:
01141188
Views:
17
>>>>
>>>>Test.MyObject mo = (Test.MyObject)Activator.CreateInstance(typeof(Test.MyObject),true);
>>>>
>>>
>>>If developers can create the object using reflection then it defeats what I'm trying to achieve anyway. (I was assuming I could prevent this by setting ReflectionPermissions - but I have'nt tried it yet...)
>>>
>>>Best,
>>>Viv
>>
>>Yes, it might be. On general it'd be too much complicated to control it. Basically what I'm doing is, just prevent direct creation (they could use reflection - actually 'they' is me and easier to control, a reminder to use factory methods instead:).
>
>I think your right. I'm not up to speed on reflection in NET2 but it seems to me that if I allow reflection on private types then anyone else can also use it to directly create the object (this circumventing my intention).
>My brain is begining to hurt :-(
>Viv

Oh yes it's friday and worse I'm 3 hrs ahead (or 2?):) Same here, brain stopped and stucked with a seemingly simple design problem.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform