What I have:
I am developing an Active Directory layer which will be used by a huge application with several modules having several solutions and projects...
I am fairly new to developing large scale solutions.
Because the current requirements are mostly to deal with User and Group objects in AD, my current solution looks like this,
- Extensions
UserPrincipalExtension
(inherting fromSystem.DirectoryServices.AccountManagement.UserPrincipal
to add custom attributes and overrideFindByIdentity
methods)GroupPrincipalExtension
(same as above but withGroupPrincipal
...)
- Models (models have override methods, e.g.
toString
, constructors etc.)- ADUser
- ADGroup
- User
- SomeUserObject
- and so on...
- Repositories
- ADUserRepo (CRUD for user, + isUserInGroup sort of methods)
- ADGroupRepo (CRUD for group, + GetUsersInGroup sort of methods)
- General
- Utilies (Get Context, etc..)
What I want OR confusion is at:
Because some methods are sort of common between User and Group Repositories, Would it be any beneficial to move all methods out of UserRepo
and GroupRepo
into a single DirectoryRepo
class and delete these repositories ?
At the moment this is creating confusion for me who is developing this, but it may confuse or either FORCE a consumer of this code to add duplicate methods.
How can I overcome this problem?
I named these repositories but these are just static methods accessing AD, sorry if that created any confusion.
Here are few of my previous questions on SO, if you want to look at some of the related code
https://stackoverflow.com/questions/32649304/repository-class