//public static string _dbtyp = ConfigurationManager.AppSettings["DatabaseType"].ToString();

        public static DBFacType DBSettings()
        {
            DBFacType db = new DBFacType();

            string dbname      = string.Empty;
            string password    = string.Empty;
            string userid      = string.Empty;
            string server      = string.Empty;
            string port        = string.Empty;
            string maxpoolsize = string.Empty;
            string conntimeout = string.Empty;
            string cmdtimeout  = string.Empty;
            string fName       = string.Empty;

            fName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "settings.INI");
            CreateINIFile(fName);

            db.DBProvider = GetIni(fName, "ProviderName", DBFactory.CDatabaseProvider.PostgreSQL);
            db.DBType     = GetIni(fName, "DatabaseType", DBFactory.CDatabaseType.PostgreSQL);
            dbname        = GetIni(fName, "DatabaseName", String.Empty);
            password      = GetIni(fName, "Password", String.Empty);
            userid        = GetIni(fName, "UserId", String.Empty);
            server        = GetIni(fName, "Server", String.Empty);
            port          = GetIni(fName, "Port", String.Empty);
            maxpoolsize   = GetIni(fName, "MaxPoolSize", "100");
            conntimeout   = GetIni(fName, "ConnectionTimeout", "60");

            db.ConnStr = string.Format(db.DBType.ToUpper() == DBFactory.CDatabaseType.Oracle ?
                                       DBFactory.CConnectString.Oracle : db.DBType.ToUpper() == DBFactory.CDatabaseType.MySQL ?
                                       DBFactory.CConnectString.MySQL : db.DBType.ToUpper() == DBFactory.CDatabaseType.PostgreSQL ?
                                       DBFactory.CConnectString.PostgreSQL : DBFactory.CConnectString.SQLServer, server, port, dbname, userid, password, maxpoolsize, conntimeout, cmdtimeout);

            return(db);
        }
        public static DBFacType GetDBSettingsMVC(IOptions <DatabaseSettings> appSettings)
        {
            DBFacType db = new DBFacType();

            string dbname      = string.Empty;
            string password    = string.Empty;
            string userid      = string.Empty;
            string server      = string.Empty;
            string port        = string.Empty;
            string maxpoolsize = string.Empty;
            string conntimeout = string.Empty;
            string cmdtimeout  = string.Empty;
            string fName       = string.Empty;

            /*
             * db.DBProvider = appSettings.Value.ProviderName; //Config.GetSection("DatabaseSettings").GetSection("ProviderName").Value; //  ConfigurationManager.AppSettings[0].ToString();//"ProviderName"
             * db.DBType = appSettings.Value.DatabaseType;
             * dbname = appSettings.Value.DatabaseName;
             * //  dbname = ConfigurationManager.AppSettings["DatabaseName"].ToString();
             * password = appSettings.Value.Password;
             * //password = ConfigurationManager.AppSettings["Password"].ToString();
             * // userid = ConfigurationManager.AppSettings["UserId"].ToString();
             * userid = appSettings.Value.UserId;
             *
             * //server = ConfigurationManager.AppSettings["Server"].ToString();
             * server = appSettings.Value.Server;
             * //port = ConfigurationManager.AppSettings["Port"].ToString();
             * port = appSettings.Value.Port.ToString();
             *
             * //maxpoolsize = ConfigurationManager.AppSettings["MaxPoolSize"].ToString();
             * maxpoolsize = appSettings.Value.MaxPoolSize.ToString();
             * //conntimeout = ConfigurationManager.AppSettings["ConnectionTimeout"].ToString();
             * conntimeout = appSettings.Value.ConnectionTimeout.ToString();
             * cmdtimeout = appSettings.Value.CommandTimeout.ToString();
             * //cmdtimeout = ConfigurationManager.AppSettings["CommandTimeout"].ToString();
             */

            fName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "settings.INI");
            CreateINIFile(fName);

            db.DBProvider = GetIni(fName, "ProviderName", DBFactory.CDatabaseProvider.PostgreSQL);
            db.DBType     = GetIni(fName, "DatabaseType", DBFactory.CDatabaseType.PostgreSQL);
            dbname        = GetIni(fName, "DatabaseName", String.Empty);
            password      = GetIni(fName, "Password", String.Empty);
            userid        = GetIni(fName, "UserId", String.Empty);
            server        = GetIni(fName, "Server", String.Empty);
            port          = GetIni(fName, "Port", String.Empty);
            maxpoolsize   = GetIni(fName, "MaxPoolSize", "100");
            conntimeout   = GetIni(fName, "ConnectionTimeout", "60");

            db.ConnStr = string.Format(db.DBType.ToUpper() == DBFactory.CDatabaseType.Oracle ?
                                       DBFactory.CConnectString.Oracle : db.DBType.ToUpper() == DBFactory.CDatabaseType.MySQL ?
                                       DBFactory.CConnectString.MySQL : db.DBType.ToUpper() == DBFactory.CDatabaseType.PostgreSQL ?
                                       DBFactory.CConnectString.PostgreSQL : DBFactory.CConnectString.SQLServer, server, port, dbname, userid, password, maxpoolsize, conntimeout, cmdtimeout);

            return(db);
        }