PC Review


Reply
Thread Tools Rate Thread

controlling access to class properties

 
 
Bob Weiner
Guest
Posts: n/a
 
      16th Feb 2005
Hi,

I'm looking at creating an account management system for our Windows AD and
have a generic OO design question.

I have a user class (user.cs) which will serve two purposes. First, it will
store information from some form of user input and be sent to the AD service
class (ad.cs) to create or modify an account. Second, it will be used by
ad.cs to store information retrieved from the AD and returned to the user
for display or manipulation or something (ie. user.java would be a Java
EJB).

The problem is that access to user.cs's properties and methods should be
different for ad.cs and the user input. For instance, the OU property
should be read/write for ad.cs but read only for the user. The DisplayName
has some business logic to restrict what the user can write to that
property, but ad.cs should be able to write anything (<shameful>not all of
our accounts apply all of our business rules</shameful>).

I had considered splitting user.cs class. Creating an internal account.cs
base class in a Windows namespace then deriving a public user.cs in the
ActMgmt namespace. That could give ad.cs (also in the Windows namespace)
all the permissions it needs without exposing itself to the user while
applying business logic to the user.cs. Unfortunately, this approach isn't
allowed by the C# compiler; it yields and inconsistent accessibility error
because the base class is less restrictive than the derived.

It seems to me that this would be a fairly generic programming issue so some
of you full-time programming guru's may have some good advice on this. A
web link would be great.

Thanks!
bob


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access and modify frameset properties in code behind class Hartmut Dippon Microsoft Dot NET 1 26th Mar 2005 09:36 PM
Access class properties with MyClass.Item syntax Joel Reinford Microsoft VB .NET 8 26th Jun 2004 11:15 PM
Re: FileInfo class access to Custom & Summary properties Gabriele G. Ponti Microsoft Dot NET Framework 1 2nd Feb 2004 02:38 PM
Re: FileInfo class access to Custom & Summary properties Gabriele G. Ponti Microsoft Dot NET Framework 6 29th Jan 2004 02:56 AM
Access a Class properties/methods from a .aspx file ????? Microsoft ASP .NET 1 30th Jul 2003 01:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:59 AM.