Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5978123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:28:08+00:00 2026-05-22T21:28:08+00:00

I’m starting to develop a set of classes to house account information. I need

  • 0

I’m starting to develop a set of classes to house account information. I need to perform CRUD operations on a number of different types of accounts (Active Directory, Google Apps, and others). I am trying to design the classes properly to start with so that they conform to OO principles and they are flexible for the future.

To give you a bit of background, I am maintaining and updating user accounts in our proximity card system, our Active Directory, our Google Apps account, and possibly a few others in the future. Each system has a different way of doing things but they do have similarities. I want to create an interface that I can code against in a way that I can drop in new account classes down the road without major changes.

The problem is that I think I might need two classes for each type of account. One class should hold the user information (for example, first name, last name, etc.) However, I need a way to find a user in each system. At first I thought of putting the FindUser method inside the class. That would work if we were only returning one user. However, I may ask for all the users with a first name of “Tom”. That might return five users. I wouldn’t want one class spawning four more instances of itself because I wouldn’t know where to store them. My thought, then, would be to have a class with the methods that stores one or more instances of a class that contains just the data.

For instance, in Active Directory, I would have the following basic structure:

MainClass:
FindUser()
FindUsers()
List<ADUsers>

ADUsers:
_firstName
_lastName
_userName
_etc.

Thus, the MainClass would be used to perform the FindUser/s methods and the users could be accessed through the list.

The other option would be to have the MainClass FindUser method return an instance of the ADUsers class and the FindUsers method return a List of ADUsers.

My question is, is this the right way to approach this overall problem? Don’t forget that I have to expand this to handle all different types of user systems. The above example would end up being my basic interface that I would extend for more complex cases.

Writing the actual code itself is not my issue (it is almost all done). My issue is laying it out properly in an intelligent design. Your help there would be much appreciated. As for language specifications, I am writing this in C#.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:28:08+00:00Added an answer on May 22, 2026 at 9:28 pm

    I wouldn’t put a find method in each type of user, objects should be unaware of their persistence. Instead why not treat things as a repository? You’d have something like

    IUserRepository<T>
      public T Create()
      public T Load(object identifer);
      public void Save(T user);
    

    etc. And then have an interface for a base user;

    IUser
      public object Identifier { get }
      public string Email { get }
    

    etc. and implement concrete versions for an AD User, a Google Apps user etc, and matching repositories. You could use the factory pattern to return the right type of repository according to your configuration or whatever else you like?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I have a view passing on information from a database: def serve_article(request, id): served_article
I need to clean up various Word 'smart' characters in user input, including but
I've tracked down a weird MySQL problem to the two different ways I was
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.