I have services (WCF) that do searches in Active Directory to provide data to many applications that use Microsoft Membership Provider, and also need some of this information in some queries in a Sql Server 2008 database, I generated a dll and I registered it on my Sql server, but I have a performance problem with my services, with the number of users increasing the services they stop frequently, after some reports I noticed that memory usage increases exponentially. I would like to know what best practice to communicate with Active Directory, register a Dll on Sql Server or use OLE DB Provider for Microsoft Directory Services?
Basically I have a layer with WCF services where I have several methods, GetUserById, GetUserByName, UsersInRole, GetRolesByUser, GetUserGroups, GetUsersInGroup, etc.
In my database I have a DLL that references this service, and I use these methods as a database function to fetch the information I need and thus filter my data.
This is a BI system, I have levels of access to differentiated information, and all security is based on Active Directory and must be managed by the information security team. The purpose of my question is to know if it is a good practice to use this DLL with the functions in Sql Server, or if I should do LDAP queries directly in my queries inside the database.