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 3344686
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:05:53+00:00 2026-05-18T01:05:53+00:00

Objective To write a effecient Active Directory library to ease the work of technicals

  • 0

Objective
To write a effecient Active Directory library to ease the work of technicals who are responsible to create access models into the domain controller’s Active Directory. This library must allow the following:

  1. Basic operations: Add, Modify, Delete, List entries;
  2. An entry may either be an organizational unit, group or user (no further need required as of now);

I thought about having a class which would represent the domain with which we want to work with.

public class Domain {
    public Domain(string root) {
        Root = root;
        Entries = new Dictionary<string, IDirectoryEntry>();
    }

    public string Root { get; private set; }
    public Dictionary<string, IDirectoryEntry> Entries { get; private set; }
}

Then, I have used dependency injection to enforce the belonging constraint to a domain of an entry. For example:

public abstract class DirectoryEntry : IDirectoryEntry {
    public DirectoryEntry(Domain domain, string name) {
        Domain = domain;
        Name = name;

        Domain.Entries.Add(name, this);
    }

    public Domain { get; private set; }
    public Name { get; set; }
}

public class OrganizationalUnit : DirectoryEntry {
    public OrganizationalUnit(Domain domain, string name)
        : base(domain, name) {
    }
}

public class Group : DirectoryEntry {
    public Group(Domain domain, string name)
        : base(domain, name) {
    }
}

Now, notice that I add the entry using Domain.Entries.Add() to the given domain upon instantiation of an IDirectoryEntry interface.

Questions

  1. Is this a good practice, if I don’t want the user to change the Domain property of any IDirectoryEntry instances?

  2. Would it be preferable to simply let this Domain.Entries.Add() line go away, and have a method within my Domain class that would add an entry to the domain?

Code Sample for question #2

public class Domain {
    //See above for other members.
    public void AddEntry<T>(T entry) {
        Entries.Add(entry.Name, entry);
    }
}

  • What is, according to you, the best architecture in this situation?

    Both seem to be good enough to be considered, so I’m a bit confused about it wanting the easiest possible way for the library end-users.

  • 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-18T01:05:54+00:00Added an answer on May 18, 2026 at 1:05 am

    Have you looked at .NET 3.5/4’s System.DirectoryServices.AccountManagement namespace? It provides much of the functionality you require in a more unified and .NET friendly interface. I personally have written a library with similar requirements to yours, using a combination of both.

    Overall, I think your design looks good, but I don’t know enough about your problem domain to know if you’ll be painting yourself into a corner so to speak.

    Specifically, to Question 1, I think that will work; however, anyone with a reference to an instance of Domain could remove any given Entry.

    To Question 2, that is very likely how I would implement it myself, unless I had a compelling reason not to.

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

Sidebar

Related Questions

I'm trying to write some c code (objective c) which will take a bank
I'm new in objective-C and here is my problem: I want to write a
1) Can i write iPhone applications in pure C++ language, i know that we
I'm new to objective-c. I can't find such classed as NSStack, NSList and so
I'm trying to write metadata to a pdf file using the following python code:
I'm hoping to write an open source IDE for a programming language I'm designing.
I am trying to make a wrapper in Objective-C so I don't have to
I'd like to store objective-c block in a property for later use. I wasn't
I have string which contains either A ,B, C, or D (example A123 or

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.