/// <summary>
        /// Retrieves the actual string from the repository.  This could be Active Directory,
        /// app.config, registry, or something else entirely.  The current implementation is
        /// using active directory through the GHCSecurity object, retrieving the connection
        /// string from the description of an AD account created specifically to store the
        /// connection strings
        /// </summary>
        /// <param name="database">string</param>
        /// <param name="environment">Environment</param>
        /// <returns>string</returns>
        private static string GetStringFromRepository(string database, DataProviderType dataProviderType, DBEnvironment environment)
        {
            string connectionString = "";

            // connection strings are stored in active directory as the description for a user.
            // the username is 'database + environment', so CLARITYDEV would return the dev
            // connection string.
            connectionString = GHCActiveDirectory.GetUserDescription(database + environment);

            #region "ResourceManager Repository"
            //System.Resources.ResourceManager rm = GHCDataAccess.Properties.Resources.ResourceManager;
            //connectionString = rm.GetString(database + environment);

            //if(connectionString == null)
            //{
            //    throw new System.ArgumentOutOfRangeException("ConnectionName", "Invalid connection name.  The database and environment requested does not exist as a resource. (" + database + " :: " + environment + ")");
            //}
            #endregion "ResourceManager Repository"

            return(connectionString);
        }
Пример #2
0
 static void GetUserDetailsTest()
 {
     Console.WriteLine(GHCActiveDirectory.GetUserDescription("CLARITYPROD"));
 }