Example #1
0
        /// <exception cref="ConnectionStringBuilderException">Parameter passen nicht</exception>
        public string getConnectionString()
        {
            string connString = null;

            if (Art == DBArts.MSSQL)
            {
                System.Data.Common.DbConnectionStringBuilder dbConnStringBuilder = new System.Data.Common.DbConnectionStringBuilder();
                connString = @"Server=" + Server + ";Initial Catalog=" + BaseDB + ";Trusted_Connection=" + Trusted.ToString() + ((bool)Trusted ? "" : ";User Id=" + Username + ";Password="******";";

                try
                {
                    dbConnStringBuilder.ConnectionString = connString;
                }
                catch (System.ArgumentException)
                {
                    throw new ConnectionStringBuilderException();
                }
            }
            if (Art == DBArts.ORACLE)
            {
                System.Data.OracleClient.OracleConnectionStringBuilder dbConnStringBuilder = new System.Data.OracleClient.OracleConnectionStringBuilder();
                connString = @"Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=" + Server + ")(PORT=" + Port + ")) (CONNECT_DATA=(SERVICE_NAME=" + Sid + "))); User Id=" + Username + ";Password="******";";

                try
                {
                    dbConnStringBuilder.ConnectionString = connString;
                }
                catch (System.ArgumentException)
                {
                    throw new ConnectionStringBuilderException();
                }
            }
            return(connString);
        }
        public void getData(string filename, string filterstring = null)
        {
            string configFilePath = "..\\..\\..\\Build\\Debug\\Configuration\\EpiInfo.Config.xml";

            Epi.DataSets.Config configDataSet = new Epi.DataSets.Config();
            configDataSet.ReadXml(configFilePath);
            Epi.Configuration.Load(configFilePath);
            System.Data.Common.DbConnectionStringBuilder dbCnnStringBuilder = new System.Data.Common.DbConnectionStringBuilder();
            string           provider  = "Epi.Data.Office.CsvFileFactory, Epi.Data.Office";
            IDbDriverFactory dbFactory = null;

            dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(provider);
            IDbDriver db = dbFactory.CreateDatabaseObject(dbCnnStringBuilder);

            db.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=..\\..\\Data;Extended Properties=\"text;HDR=Yes;FMT=Delimited\"";
            object selectedDataSource = db;

            IDbDriver dbDriver = (IDbDriver)selectedDataSource;

            DashboardHelper = new DashboardHelper(filename + "#csv", dbDriver);
            IGadgetParameters inputs = new GadgetParameters();

            DashboardHelper.UserVarsNeedUpdating = true;
            string fs = null;

            if (!String.IsNullOrEmpty(filterstring))
            {
                fs = "select * from " + filename + "#csv where " + filterstring;
            }
            PopulateDataSet(inputs, fs);
        }
        public bool Connect()
        {
            var builder = new System.Data.Common.DbConnectionStringBuilder();

            builder["Username"] = _view.Username;
            builder["Password"] = _view.Password;
            builder["Service"]  = _view.Service;
            if (!string.IsNullOrEmpty(_view.OracleSchema))
            {
                builder["OracleSchema"] = _view.OracleSchema;
            }
            if (!string.IsNullOrEmpty(_view.KingFdoClass))
            {
                builder["KingFdoClass"] = _view.KingFdoClass;
            }
            if (!string.IsNullOrEmpty(_view.SdeSchema))
            {
                builder["SDE Schema"] = _view.SdeSchema;
            }
            FdoConnection conn = new FdoConnection("OSGeo.KingOracle", builder.ToString());

            if (conn.Open() == FdoConnectionState.Open)
            {
                IFdoConnectionManager mgr = ServiceManager.Instance.GetService <IFdoConnectionManager>();
                mgr.AddConnection(_view.ConnectionName, conn);
                return(true);
            }

            _view.ShowMessage(null, "Connection failed");
            return(false);
        }
Example #4
0
        public bool DatabaseExists()
        {
            const string strSql = "SELECT DB_ID(@Database) ";
            bool         result = false;

            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder
            {
                ConnectionString = SqlHelper.ConnString
            };
            if (!builder.ContainsKey("initial catalog"))
            {
                return(true);
            }

            string database = builder["initial catalog"] as string;

            builder["initial catalog"] = "master";

            var res = SqlHelper.ExecuteScalar(builder.ConnectionString, CommandType.Text, strSql, new SqlParameter("@Database", SqlDbType.VarChar)
            {
                Value = database
            });

            result = (res.ConvertDBNull() != DBNull.Value);

            return(result);
        }
        public static IDataProtectionBuilder ConfigureDataProtection(this IDataProtectionBuilder builder, DataProtectionOptions options)
        {
            builder.SetDefaultKeyLifetime(options.KeyLifeTime);
            builder.SetApplicationName(options.ApplicationName);
            var csBuilder = new System.Data.Common.DbConnectionStringBuilder
            {
                ConnectionString = options.ConnectionString
            };

            switch (options.Type)
            {
            case DataProtectionPersistenceType.FileSystem:
                var dirInfo = new DirectoryInfo(csBuilder["Path"].ToString());
                builder.PersistKeysToFileSystem(dirInfo);
                return(builder);

            case DataProtectionPersistenceType.Redis:
            {
                var uri      = csBuilder["uri"].ToString();
                var keystore = csBuilder["keystore"].ToString();
                if (string.IsNullOrWhiteSpace(keystore))
                {
                    keystore = "DataProtection-Keys";
                }
                var redis = ConnectionMultiplexer.Connect(uri);
                builder.PersistKeysToStackExchangeRedis(redis, keystore);
                return(builder);
            }

            default:
                throw new ArgumentOutOfRangeException($"No builder present for the specified type: [{options.Type}]");
            }
        }
Example #6
0
 /// <summary>
 /// 设置构造器的参数。
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="values">参数列表。</param>
 /// <param name="name">标准命名。</param>
 /// <param name="aliasName">别名。</param>
 /// <param name="filter">过滤器。</param>
 protected void SetBuilderValue(System.Data.Common.DbConnectionStringBuilder builder, Collections.Generic.NameValueCollection <object> values, string name, string aliasName, ValueFilter filter = null)
 {
     if (SetBuilderValue(builder, aliasName, values[name], filter))
     {
         values.Remove(name);
     }
 }
Example #7
0
 /// <summary>
 /// 设置构造器的参数。
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="name">参数名称。</param>
 /// <param name="value">参数值,为null时,自动跳过。</param>
 /// <param name="filter">过滤器。</param>
 /// <returns>返回是否操作成功。</returns>
 protected bool SetBuilderValue(System.Data.Common.DbConnectionStringBuilder builder, string name, object value, ValueFilter filter = null)
 {
     if (value == null)
     {
         return(false);
     }
     try {
         if (filter != null)
         {
             value = filter(value);
             if (value == null)
             {
                 return(false);
             }
         }
         if (value is string)
         {
             if (string.IsNullOrEmpty((string)value))
             {
                 return(false);
             }
         }
         if (name.IndexOf(' ') > -1)
         {
             builder[name] = value;
         }
         else
         {
             FastWrapper.Set(builder, name, value, System.Reflection.BindingFlags.IgnoreCase);
         }
         return(true);
     } catch (System.Exception) {
         return(false);
     }
 }
Example #8
0
        /// <summary>
        /// Définir la chaine de connexion
        /// instanciation du  IDbConnection
        /// </summary>
        /// <param name="connectionString"></param>
        /// <param name="defaultEngine"></param>
        public void SetConnectionString(string connectionString, string defaultEngine)
        {
            //NpgsqlConnectionStringBuilder nchainbuild = new NpgsqlConnectionStringBuilder(this.ConnectionString);
            //this.ConnectionString = nchainbuild.ToString();

            if (this.connection != null)
            {
                throw new Exception("Connector already in use");
            }
            this.ConnectionString = connectionString;
            this.EngineName       = defaultEngine;

            if (string.IsNullOrWhiteSpace(this.ConnectionString))
            {
                throw new Exception("Sql connexion string empty");
            }

            //https://www.npgsql.org/doc/connection-string-parameters.html
            System.Data.Common.DbConnectionStringBuilder dbConnectionStringBuilder = null;
            // Factorisation du connecteur SGBD

            this.connection = this.ConnectionFactory();
            this.connection.ConnectionString = this.ConnectionString;
            //if (connection == null) throw new Exception();
        }
        public static ElasticsearchConnection BuildElsticSearchConnection(string connectionString)
        {
            try
            {
                var builder = new System.Data.Common.DbConnectionStringBuilder();
                builder.ConnectionString = connectionString.Replace("{", "\"").Replace("}", "\"");

                var lookup = new StringDictionary();
                foreach (string key in builder.Keys)
                {
                    lookup[key] = Convert.ToString(builder[key]);
                }

                var index = lookup["Index"];

                // If the user asked for rolling logs, setup the index by day
                if (!string.IsNullOrEmpty(lookup["rolling"]))
                    if (lookup["rolling"] == "true")
                        index = string.Format("{0}-{1}", index, DateTime.Now.ToString("yyyy.MM.dd"));

                return
                    new ElasticsearchConnection
                    {
                        Server = lookup["Server"],
                        Port = lookup["Port"],
                        Index = index
                    };
            }
            catch
            {
                throw new InvalidOperationException("Not a valid connection string");
            }
        }
Example #10
0
        public CSQLHelper(string strConnectionString)
        {
            /*  LAMMN: 07/11/2016
             *  Check connectstring -> return chuỗi connectstring
             */

            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();

            builder.ConnectionString = strConnectionString;
            string database = builder["database"] as string;

            if (database == "xxxx") //Nếu là chuỗi kết nối tới các member
            {
                if (HttpContext.Current.Session[CConfig.SESSION_HOTELGROUPCODE] != null)
                {
                    string HotelGroup = HttpContext.Current.Session[CConfig.SESSION_HOTELGROUPCODE].ToString().Trim();
                    strConnectionString = strConnectionString.Replace("xxxx", HotelGroup);
                }
                //else //hết phiên làm việc
                //{
                //    HttpContext.Current.Response.Redirect("~/Accounts/Login", false);
                //}
            }

            this.m_ConnectionString = strConnectionString;
            this.m_dblDuration      = 0;
        }
Example #11
0
        public static string GetConnectionString()
        {
            System.Data.SqlClient.SqlConnectionStringBuilder sb = new System.Data.SqlClient.SqlConnectionStringBuilder();
            sb.DataSource               = Environment.MachineName;
            sb.InitialCatalog           = "COR_Basic_Demo";
            sb.IntegratedSecurity       = true;
            sb.MultipleActiveResultSets = true;
            sb.PersistSecurityInfo      = false;
            sb.Pooling         = true;
            sb.PacketSize      = 4096;
            sb.ApplicationName = "ODataTest";


            Npgsql.NpgsqlConnectionStringBuilder csb = new Npgsql.NpgsqlConnectionStringBuilder();
            csb.Host     = "127.0.0.1";
            csb.Port     = 5432;
            csb.Database = "blogz";

            // csb.IntegratedSecurity = false;
            // CREATE ROLE alibaba LOGIN PASSWORD 'OpenSesame' SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;
            csb.UserName        = "******";
            csb.Password        = "******";
            csb.CommandTimeout  = 300;
            csb.ApplicationName = "ODataTest";

            System.Data.Common.DbConnectionStringBuilder dbcs = sb;
            if (System.Environment.OSVersion.Platform == PlatformID.Unix)
            {
                dbcs = csb;
            }

            return(dbcs.ConnectionString);
        }
Example #12
0
        private static void PerformUpdate(string connectionString)
        {
            var builder = new System.Data.Common.DbConnectionStringBuilder {
                ConnectionString = connectionString
            };
            string dbName = (builder["Initial Catalog"] as string);

            Log.Information($"Begin migration - DBname:{dbName}");

            EnsureDatabase.For.SqlDatabase(connectionString);

            var upgrader =
                DeployChanges.To
                .SqlDatabase(connectionString)
                .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly(), script =>
            {
                return(true);
            })
                .LogTo(new SerilogUpgradeLogger())
                .Build();
            var result = upgrader.PerformUpgrade();

            if (result.Successful)
            {
                Log.Information($"{dbName} database script deployment successful");
            }
            else
            {
                Log.Information($"{dbName} database cript deployment failed");
                throw result.Error;
            }
            Log.Information($"End migration - DbName: {dbName}");
        }
Example #13
0
        /// <summary>
        /// log
        /// </summary>
        /// <param name="Params"></param>
        /// <returns></returns>
        public string GetParamInfo()
        {
            SqlParameterCollection Params = this.m_Command.Parameters;

            int    i = 0;
            string s = "\r\n";

            for (i = 0; i <= Params.Count - 1; i++)
            {
                s += "\t" + Params[i].ParameterName + "='" + Params[i].Value + "',\r\n";
            }

            if (_OpenConnection() == false)           // Open Connection
            {
                return(null);
            }

            //<add name="CONNECTION_STRING_50" connectionString="server=10.26.248.50;UID=sa;PWD=sa;database=EzTransfer;Connect Timeout=30;Pooling=false;"  providerName="System.Data.SqlClient"/>
            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
            builder.ConnectionString = this.Connection.ConnectionString;
            string strServer   = builder["server"] as string;
            string strDatabase = builder["database"] as string;

            s += CConfig.CHAR_TAB + "--" + strServer + "=>" + strDatabase + CConfig.CHAR_CRLF;

            return(s);
        }
 private static void updateContextConnection(UserViewModel dbUser, ServiceSheetsEntities dbContext)
 {
     System.Data.Common.DbConnection connection       = dbContext.Database.Connection;
     System.Data.Common.DbConnectionStringBuilder str = new System.Data.Common.DbConnectionStringBuilder();
     str.ConnectionString = dbContext.Database.Connection.ConnectionString;
     str.Add("Password", dbUser.PasswordBoxObj.Password);
     dbContext.Database.Connection.ConnectionString = str.ConnectionString;
 }
Example #15
0
 public static string GetSectionFromString(string connectionString, string key)
 {
     var builder = new System.Data.Common.DbConnectionStringBuilder
     {
         ConnectionString = connectionString
     };
     return (string)builder[key];
 }
Example #16
0
 public SqlServerManager(string connectionString)
 {
     System.Data.Common.DbConnectionStringBuilder builder = GetConnectionStringBuilder();
     builder.ConnectionString = connectionString;
     this.Server         = builder["DataSource"].ToString();
     this.ServerUserName = builder["UserID"].ToString();
     this.ServerPassword = builder["Password"].ToString();
 }
        private static string GetDbNameFromConnectionString(string connectionString)
        {
            var builder = new System.Data.Common.DbConnectionStringBuilder {
                ConnectionString = connectionString
            };

            return(builder["Database"] as string);
        }
Example #18
0
        private string GetPartialConnectionStringForDataStoreEnumeration()
        {
            var builder = new System.Data.Common.DbConnectionStringBuilder();

            builder["Service"]  = _fs.GetConnectionProperty("Service"); //NOXLATE
            builder["Username"] = txtUsername.Text;                     //_fs.GetConnectionProperty("Username"); //NOXLATE
            builder["Password"] = txtPassword.Text;                     //_fs.GetConnectionProperty("Password"); //NOXLATE
            return(builder.ToString());
        }
        static CosmosDBHelpers()
        {
            var builder = new System.Data.Common.DbConnectionStringBuilder();

            builder.ConnectionString = Constants.CosmosDB.CosmosDBConnectionStringSetting;
            var serviceUri = new Uri(builder["AccountEndpoint"].ToString());

            _docDbClient = new DocumentClient(serviceUri, builder["AccountKey"].ToString());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["Menu"] == null)
                {
                    Session.Clear();
                    NavMenu.Visible = false;
                }
                if (Session["Menu"] != null)
                {
                    navBarCollapseIndar.Controls.Add(new LiteralControl(Session["Menu"].ToString()));
                    NavMenu.Visible = Session["Menu"] != null; // Si hay menú se muestra, de lo conotrario se oculta
                    if (Session["Tab"].Equals("Salir"))
                    {
                        Session.Clear();
                        Response.Redirect("Login.aspx");
                    }
                

#if DEBUG
                txtDebug.Visible = true;
                System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
                builder.ConnectionString = ConfigurationManager.ConnectionStrings["BD"].ConnectionString;
                string server = builder["Data Source"] as string;
                string database = builder["Initial Catalog"] as string;

                Label myLabel = this.FindControl("txtBdName") as Label;
                myLabel.Text = ("Debug en: " + server + ". Base de Datos: " + database);
#endif
            }

            Control contentPh = FindControl("ContentSection");
            foreach (Control controlCph in contentPh.Controls)
                if (controlCph is MultiView)
                {
                    foreach (Control controlMv in controlCph.Controls)
                        if (controlMv is View)
                        {
                            foreach (Control controlV in controlMv.Controls)
                                if (controlV is Panel)
                                {
                                    foreach (Control controlP in controlV.Controls)
                                        if (controlP is RadGrid)
                                            ChangeLanguageRadFilterMenu((RadGrid)controlP);
                                }
                                else if (controlV is RadGrid)
                                    ChangeLanguageRadFilterMenu((RadGrid)controlV);
                        }
                        else if (controlMv is RadGrid)
                            ChangeLanguageRadFilterMenu((RadGrid)controlMv);
                }
                else if (controlCph is RadGrid)
                    ChangeLanguageRadFilterMenu((RadGrid)controlCph);
        }
        /// <summary>
        /// Get attribute value fom connection string builder.
        /// </summary>
        /// <param name="connectionStringBuilder">Builder where to read attribute.</param>
        /// <param name="attributeKey">Attribute to read.</param>
        /// <param name="fallbackValue">Fallback value where attribute does not exists.</param>
        /// <returns>Value of requested attribute.</returns>
        private string GetConnectionStringValue(System.Data.Common.DbConnectionStringBuilder connectionStringBuilder, string attributeKey, string fallbackValue = null)
        {
            object result;

            if (connectionStringBuilder.TryGetValue(attributeKey, out result) == false)
            {
                return(fallbackValue);
            }

            return(result.ToString());
        }
        /// <summary>
        /// Create a ConnectionString to log in.
        /// </summary>
        /// <param name="sambaPath">The path of Samba shared folder; ex.: "\\server\folder"..</param>
        /// <param name="username">Username to log in.</param>
        /// <param name="domain">Domain of Username to log in.</param>
        /// <param name="password">Password to log in.</param>
        /// <returns>Encoded connection string</returns>
        public string Encode(string sambaPath, string username, string domain, string password)
        {
            var builder = new System.Data.Common.DbConnectionStringBuilder();

            builder.Add(Constants.ConnectionString.SambaPathKey, sambaPath);
            builder.Add(Constants.ConnectionString.UsernameKey, username);
            builder.Add(Constants.ConnectionString.DomainKey, domain);
            builder.Add(Constants.ConnectionString.PasswordKey, password);

            return(builder.ConnectionString);
        }
Example #23
0
        public string GetConnectionStringDbName(string sap_conn_name)
        {
            GetConnectionString(sap_conn_name);
            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
            builder.ConnectionString = GetConnectionString(sap_conn_name);


            string database = builder["Initial Catalog"] as string;

            return(database);
        }
        static DocumentClient CreateClient(string connectionString)
        {
            // Use a DBConnectionStringBuilder isntance to parse the properties
            // in the connection string for us.
            var builder = new System.Data.Common.DbConnectionStringBuilder()
            {
                ConnectionString = connectionString
            };

            return(new DocumentClient(new Uri($"{builder["AccountEndpoint"]}"), $"{builder["AccountKey"]}"));
        }
Example #25
0
        public async Task InitializeDocumentClient()
        {
            if (DocumentClient == null)
            {
                var builder = new System.Data.Common.DbConnectionStringBuilder();
                builder.ConnectionString = Environment.GetEnvironmentVariable("AzureWebJobsCosmosDBConnectionString");
                var serviceUri = new Uri(builder["AccountEndpoint"].ToString());

                DocumentClient = new DocumentClient(serviceUri, builder["AccountKey"].ToString());
                await DocumentClient.OpenAsync();
            }
        }
Example #26
0
        public void DropTablesIfExist()
        {
            if (Globals.VerboseLogging)
            {
                Logger.Info("Dropping database tables.");
            }

            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
            builder.ConnectionString = Database.Connection.ConnectionString;

            string databaseName = builder["Database"] as string;

            var tables = Assembly.GetExecutingAssembly().GetTypes()
                         .Where(t => t.Namespace == "TagCleanup.Data.Tables")
                         .ToList();

            foreach (var table in tables)
            {
                string        tableName    = "";
                StringBuilder tableSQL     = new StringBuilder();
                List <string> tableIndexes = new List <string>();

                var tableAttibutes = table.GetCustomAttributes(typeof(TableAttribute), true);

                foreach (TableAttribute tableAttribute in tableAttibutes)
                {
                    if (tableAttribute != null)
                    {
                        tableName = tableAttribute.Name;
                    }
                }

                if (!string.IsNullOrWhiteSpace(tableName))
                {
                    if (Globals.VerboseLogging)
                    {
                        Logger.Info($"Dropping database table '{tableName}'.");
                    }

                    tableSQL.Append("DROP TABLE IF EXISTS `");
                    tableSQL.Append(databaseName);
                    tableSQL.Append("`.`");
                    tableSQL.Append(tableName);
                    tableSQL.Append("`; ");

                    var result = ExecuteQuery(tableSQL.ToString());
                }
                else
                {
                    throw new Exception("Table does not have a name defined in the custom attribute.");
                }
            }
        }
Example #27
0
        public async Task InitializeDocumentClient()
        {
            if (DocumentClient == null)
            {
                var builder = new System.Data.Common.DbConnectionStringBuilder();
                builder.ConnectionString = AmbientConnectionStringProvider.Instance.GetConnectionString("AzureWebJobsDocumentDBConnectionString");
                var serviceUri = new Uri(builder["AccountEndpoint"].ToString());

                DocumentClient = new DocumentClient(serviceUri, builder["AccountKey"].ToString());
                await DocumentClient.OpenAsync();
            }
        }
Example #28
0
        private void ReadConfigurationFile()
        {
            _connectionString = ConfigurationManager.ConnectionStrings["Dynamics365ConnectionString"]?.ConnectionString;

            var connStringBuilder = new System.Data.Common.DbConnectionStringBuilder();

            connStringBuilder.ConnectionString = _connectionString;

            _dynamics365Url = connStringBuilder.ContainsKey("Url") ? connStringBuilder["Url"].ToString() : string.Empty;
            _username       = connStringBuilder.ContainsKey("Username") ? connStringBuilder["Username"].ToString() : string.Empty;
            _password       = connStringBuilder.ContainsKey("Password") ? connStringBuilder["Password"].ToString() : string.Empty;
        }
Example #29
0
        /// <summary>
        /// 创建数据库连接。
        /// </summary>
        /// <param name="connectionOptions">连接参数。</param>
        /// <returns>返回数据库连接。</returns>
        public override IConnection CreateConnection(object connectionOptions)
        {
            {
                if (connectionOptions is string connectionString)
                {
                    connectionString = connectionString.Trim();
                    if (connectionString.StartsWith("{"))
                    {
                        connectionOptions = JSON.Parse(connectionString);
                        goto lb_Object;
                    }
                    return(CreateConnection(connectionString));
                }
                if (connectionOptions is ConnectionOptions connectionOptions2)
                {
                    connectionOptions = connectionOptions2.ToObject();
                    goto lb_Object;
                }
            }
lb_Object:
            System.Data.Common.DbConnectionStringBuilder builder = FastWrapper.CreateInstance <System.Data.Common.DbConnectionStringBuilder>(GetType("MySql.Data.MySqlClient.MySqlConnectionStringBuilder", true));
            builder["pooling"] = true;
            //builder["MaxPoolSize"] = 1024;
            //builder["Port"] = 5432;
            builder["Charset"] = "utf8";
            Collections.Generic.NameValueCollection <object> values = new Collections.Generic.NameValueCollection <object>(connectionOptions);
            SetBuilderValue(builder, "SslMode", "None");
            SetBuilderValue(builder, values, "port", "Port");
            SetBuilderValue(builder, values, "host", "Data Source", p => {
                string p10 = p as string;
                if (string.IsNullOrEmpty(p10))
                {
                    return(p);
                }
                if (p10.IndexOf(':') > -1)
                {
                    string[] pair = p10.Split(':');
                    SetBuilderValue(builder, "Port", pair[1]);
                    return(pair[0]);
                }
                return(p);
            });
            SetBuilderValue(builder, values, "name", "Database");
            SetBuilderValue(builder, values, "account", "User ID");
            SetBuilderValue(builder, values, "password", "Password");
            foreach (System.Collections.Generic.KeyValuePair <string, object> item in values)
            {
                //builder[item.Key] = item.Value;
                SetBuilderValue(builder, item.Key, item.Value);
            }
            return(CreateConnection(builder.ConnectionString));
        }
    private string GetConnectionString()
    {
        var connectionString = System.Configuration.ConfigurationManager.
                               ConnectionStrings["connectionStringName"].ConnectionString;
        var builder = new System.Data.Common.DbConnectionStringBuilder();

        builder.ConnectionString = connectionString;
        var internalConnectionString = builder["provider connection string"].ToString();
        var newConnectionString      = internalConnectionString.Replace("oldDBName", "newDBName");

        builder["provider connection string"] = newConnectionString;
        return(builder.ConnectionString);
    }
        public void EnsureDatabaseExists()
        {
            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();

            builder.ConnectionString = ConnectionString;

            string databaseFilename = builder["Data Source"] as string;

            if (!File.Exists(databaseFilename))
            {
                this.InitDatabase();
            }
        }
Example #32
0
        public void TestConnectionString()
        {
            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
            builder["Foo"] = "sdfjkg";
            builder["Bar"] = "skgjuksdf";
            builder["Snafu"] = "asjdgjh;sdgj"; //Note the ; in the value
            builder["Whatever"] = "asjd=gjh;sdgj"; //Note the ; and = in the value

            var values = ConnectionProviderRegistry.ParseConnectionString(builder.ToString());
            Assert.AreEqual(values.Count, 4);

            Assert.AreEqual(builder["Foo"].ToString(), values["Foo"]);
            Assert.AreEqual(builder["Bar"].ToString(), values["Bar"]);
            Assert.AreEqual(builder["Snafu"].ToString(), values["Snafu"]);
            Assert.AreEqual(builder["Whatever"].ToString(), values["Whatever"]);
        }
Example #33
0
        public bool DatabaseExists()
        {
            const string strSql = "SELECT DB_ID(@Database) ";
            bool result = false;
            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder
                                                                   {
                                                                       ConnectionString = SqlHelper.ConnString
                                                                   };
            if (!builder.ContainsKey("initial catalog"))
                return true;

            string database = builder["initial catalog"] as string;
            builder["initial catalog"] = "master";

            var res = SqlHelper.ExecuteScalar(builder.ConnectionString, CommandType.Text, strSql, new SqlParameter("@Database", SqlDbType.VarChar) { Value = database });

            result = (res.ConvertDBNull() != DBNull.Value);

            return result;
        }
        public static ConnectionSettings BuildElsticSearchConnection(string connectionString)
        {
            try
            {
                var builder = new System.Data.Common.DbConnectionStringBuilder();
                builder.ConnectionString = connectionString.Replace("{", "\"").Replace("}", "\"");

                StringDictionary lookup = new StringDictionary();
                foreach (string key in builder.Keys)
                {
                    lookup[key] = Convert.ToString(builder[key]);
                }

                return
                    new ConnectionSettings(new Uri(string.Format("http://{0}:{1}", lookup["Server"], 
                        Convert.ToInt32(lookup["Port"])))).SetDefaultIndex(lookup["Index"]);
            }
            catch
            {
                throw new InvalidOperationException("Not a valid connection string");
            }
        }
        public bool Connect()
        {
            var builder = new System.Data.Common.DbConnectionStringBuilder();
            builder["Username"] = _view.Username;
            builder["Password"] = _view.Password;
            builder["Service"] = _view.Service;
            if (!string.IsNullOrEmpty(_view.OracleSchema))
                builder["OracleSchema"] = _view.OracleSchema;
            if (!string.IsNullOrEmpty(_view.KingFdoClass))
                builder["KingFdoClass"] = _view.KingFdoClass;
            if (!string.IsNullOrEmpty(_view.SdeSchema))
                builder["SDE Schema"] = _view.SdeSchema;
            FdoConnection conn = new FdoConnection("OSGeo.KingOracle", builder.ToString());
            if (conn.Open() == FdoConnectionState.Open)
            {
                IFdoConnectionManager mgr = ServiceManager.Instance.GetService<IFdoConnectionManager>();
                mgr.AddConnection(_view.ConnectionName, conn);
                return true;
            }

            _view.ShowMessage(null, "Connection failed");
            return false;
        }
Example #36
0
        /// <summary>
        /// This method determines a provider from the given Connection String.
        /// The default value is the SqlServer provider.
        /// </summary>
        /// <param name="ConnectString">Connection Stirng</param>
        /// <returns>Provider</returns>
        public static EnumProviders GetProvider(string ConnectString)
        {
            EnumProviders provider;

            System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
            builder.ConnectionString = ConnectString;

            // Initial value
            provider = EnumProviders.SqlServer;

            string connectionStringProviderValue = "";
            if (builder.ContainsKey("Provider"))
            { connectionStringProviderValue = builder["Provider"].ToString(); }
            else
            { connectionStringProviderValue = ""; }

            switch (connectionStringProviderValue)
            {
                case "Microsoft.ACE.OLEDB.12.0":
                    provider = EnumProviders.OleDb;
                    break;
                case "Microsoft.Jet.OLEDB.4.0;":
                    provider = EnumProviders.OleDb;
                    break;
                case "SQLNCLI10":
                    provider = EnumProviders.SqlServer;
                    break;
                default:
                    provider = EnumProviders.SqlServer;
                    break;
            }

            return provider;
        }
        /// <summary>
        /// Initialize the Connection Parameters using the Connection String Settings
        /// </summary>
        /// <param name="settings"></param>
        public void ReadConnectionParameters(ConnectionStringSettings settings)
        {
            var connectionString = new System.Data.Common.DbConnectionStringBuilder { ConnectionString = settings.ConnectionString };

            if (connectionString.ContainsKey("DriverClass"))
            {
                Connection_DriverClass = (string)connectionString["DriverClass"];
                connectionString.Remove("DriverClass");
            }
            else
                throw new ConnectionElementNotFoundException("DriverClass");

            if (connectionString.ContainsKey("Dialect"))
            {
                Dialect = (string)connectionString["Dialect"];
                connectionString.Remove("Dialect");
            }
            else
                throw new ConnectionElementNotFoundException("Dialect");

            if (connectionString.ContainsKey("TablePrefix"))
            {
                TablePrefix = (string)connectionString["TablePrefix"];
                connectionString.Remove("TablePrefix");
            }

            Connection_ConnectionString = connectionString.ConnectionString;
        }
 private void ConnectionBuilderForm_Load(object sender, EventArgs e)
 {
     _builder = new System.Data.SqlClient.SqlConnectionStringBuilder();
     this.propertyGrid1.SelectedObject = _builder;
 }
Example #39
0
        private void makeSQLProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Epi.Data.IDbDriverFactory dbFactory = Epi.Data.DbDriverFactoryCreator.GetDbDriverFactory(Configuration.SqlDriver);
            string connectionString = string.Empty;
            System.Data.Common.DbConnectionStringBuilder dbCnnStringBuilder = new System.Data.Common.DbConnectionStringBuilder();
            Epi.Data.IDbDriver db = dbFactory.CreateDatabaseObject(dbCnnStringBuilder);
                //IDbDriver db = DatabaseFactoryCreator.CreateDatabaseInstance(selectedPlugIn.Key);
                //IConnectionStringGui dialog = db.GetConnectionStringGuiForExistingDb();
                ////IConnectionStringGui dialog = this.selectedProject.Metadata.DBFactory.GetConnectionStringGuiForExistingDb();
            Epi.Data.IConnectionStringGui dialog = dbFactory.GetConnectionStringGuiForExistingDb();

            DialogResult result = ((Form)dialog).ShowDialog();

            bool success = false;

            if (result == DialogResult.OK)
            {

                db.ConnectionString = dialog.DbConnectionStringBuilder.ToString();
                connectionString = db.ConnectionString;

                try
                {
                    success = db.TestConnection();
                }
                catch
                {
                    success = false;
                    MessageBox.Show(SharedStrings.ERROR_CONNECT_DATA_SOURCE);
                }
            }

            if (success)
            {
                OpenFileDialog openFileDialog = new OpenFileDialog();
                openFileDialog.CheckFileExists = false;
                openFileDialog.Filter = "Epi Info " + SharedStrings.PROJECT_FILE + " (*.prj)|*.prj";

                result = openFileDialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    string projectName = openFileDialog.FileName;
                    if (File.Exists(projectName))
                    {
                        DialogResult overwriteResult = Epi.Windows.MsgBox.Show(string.Format(SharedStrings.PROJECT_ALREADY_EXISTS, projectName), SharedStrings.PROJECT_ALREADY_EXISTS_TITLE, MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                        if (overwriteResult != System.Windows.Forms.DialogResult.Yes)
                        {
                            return;
                        }
                    }

                    FileInfo fi = new FileInfo(openFileDialog.FileName);

                    if (Util.CreateProjectFileFromDatabase(connectionString, true, fi.DirectoryName, fi.Name) != null)
                    {
                        Epi.Windows.MsgBox.ShowInformation(SharedStrings.PROJECT_FILE_CREATED);
                    }
                    else
                    {
                        Epi.Windows.MsgBox.ShowError(SharedStrings.PROJECT_FILE_NOT_CREATED);
                    }
                }
            }
        }
Example #40
0
        private string GetConfigArguments(Config config, CreationType type)
        {
            var sb = new StringBuilder();
            if (!config.UseConnectionString)
            {
                sb.AppendFormat("/url:\"{0}\" ", config.Url);
            }

            foreach (var argument in config.CommandLineArguments.Where(a => a.SettingType == CreationType.All || a.SettingType == type))
            {
                var value = argument.Value;
                if (argument.Name == "out")
                {
                    value = GetOutputFilePath(config, type);
                }
                if (argument.Value == null)
                {
                    sb.AppendFormat("/{0} ", argument.Name);
                }
                else
                {
                    sb.AppendFormat("/{0}:\"{1}\" ", argument.Name, value);
                }
            }

            if (!string.IsNullOrWhiteSpace(config.Password))
            {
                if (Config.UseConnectionString)
                {
                    // Fix for https://github.com/daryllabar/DLaB.Xrm.XrmToolBoxTools/issues/14 - Problem with CRM 2016 on premises with ADFS
                    // CrmSvcUtil.exe /out:entitie.cs / connectionstring:"Url=https://serverName.domain.com:444/orgName;Domain=myDomain;UserName=username;Password=*****"
                    // And this command doesn't work :
                    // CrmSvcUtil.exe /out:entitie.cs /url:"https://serverName.domain.com:444/orgName" / domain:"myDomain" / username:"******" / password:"******"

                    var domain = string.Empty;
                    if (!string.IsNullOrWhiteSpace(config.Domain))
                    {
                        domain = "Domain=" +config.Domain + ";";
                    }
                    var password = config.Password.Replace("\"", "^\"").Replace("&", "^&");  // Handle Double Quotes and &s???
                    var builder = new System.Data.Common.DbConnectionStringBuilder
                    {
                        {"A", $"Url={config.Url};{domain}UserName={config.UserName};Password={password}"}
                    };
                    
                    sb.AppendFormat("/connectionstring:{0} ", builder.ConnectionString.Substring(2)); // Replace "A=" with "/connectionstring:"
                }
                else
                {
                    sb.AppendFormat("/username:\"{0}\" ", config.UserName);
                    sb.AppendFormat("/password:\"{0}\" ", config.Password);

                    // Add Login Info
                    if (!config.UseCrmOnline && !string.IsNullOrWhiteSpace(config.Domain))
                    {
                        sb.AppendFormat("/domain:\"{0}\" ", config.Domain);
                    }
                }
            }

            return sb.ToString();
        }
Example #41
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            using (new WaitCursor(this))
            {
                try
                {
                    PreferedSite ps = null;

                    if (_selectedIndex == 0) //HTTP
                    {
                        var builder = new System.Data.Common.DbConnectionStringBuilder();
                        builder["Url"] = _http.Server; //NOXLATE
                        builder["Username"] = _http.Username; //NOXLATE
                        builder["Password"] = _http.Password; //NOXLATE
                        builder["Locale"] = _http.Language; //NOXLATE
                        builder["AllowUntestedVersion"] = true; //NOXLATE

                        string agent = "MapGuide Maestro v" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); //NOXLATE

                        _conn = ConnectionProviderRegistry.CreateConnection("Maestro.Http", builder.ToString()); //NOXLATE
                        _conn.SetCustomProperty("UserAgent", agent); //NOXLATE

                        //Update preferred site entry if it exists
                        int index = 0;
                        foreach (PreferedSite s in _http.GetSites())
                        {
                            if (s.SiteURL == _http.Server)
                            {
                                ps = s;
                                break;
                            }
                            else
                                index++;
                        }

                        if (ps == null)
                            ps = new PreferedSite();

                        if (ps.ApprovedVersion == null)
                            ps.ApprovedVersion = new Version(0, 0, 0, 0);

                        if (_conn.SiteVersion > _conn.MaxTestedVersion && _conn.SiteVersion > ps.ApprovedVersion)
                        {
                            if (MessageBox.Show(this, Strings.UntestedServerVersion, Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning) != DialogResult.Yes)
                                return;
                        }

                        try
                        {
                            ps.SiteURL = _http.Server;
                            ps.StartingPoint = _http.StartingPoint;
                            ps.Username = _http.Username;
                            ps.SavePassword = chkSavePassword.Checked;
                            ps.ApprovedVersion = ps.ApprovedVersion > _conn.SiteVersion ? ps.ApprovedVersion : _conn.SiteVersion;
                            if (ps.SavePassword)
                                ps.UnscrambledPassword = _http.Password;
                            else
                                ps.ScrambledPassword = string.Empty;

                            if (index >= _siteList.Sites.Length)
                                _siteList.AddSite(ps);

                            //_siteList.AutoConnect = chkAutoConnect.Checked;
                            _siteList.PreferedSite = index;
                            var ci = _http.SelectedCulture;
                            if (ci != null)
                            {
                                _siteList.GUILanguage = ci.Name;
                            }
                            _siteList.Save();
                        }
                        catch (Exception)
                        {

                        }
                    }
                    else if (_selectedIndex == 1) //Native
                    {
                        System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder();
                        builder["ConfigFile"] = LocalNativeLoginCtrl.LastIniPath; //NOXLATE
                        builder["Username"] = _localNative.Username; //NOXLATE
                        builder["Password"] = _localNative.Password; //NOXLATE
                        builder["Locale"] = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName; //NOXLATE
                        _conn = ConnectionProviderRegistry.CreateConnection("Maestro.LocalNative", builder.ToString()); //NOXLATE
                    }
                    else //Local
                    {
                        NameValueCollection param = new NameValueCollection();
                        param["ConfigFile"] = LocalLoginCtrl.LastIniPath; //NOXLATE
                        _conn = ConnectionProviderRegistry.CreateConnection("Maestro.Local", param); //NOXLATE
                    }

                    _conn.AutoRestartSession = true;

                    this.DialogResult = DialogResult.OK;
                    this.Close();

                }
                catch (TargetInvocationException ex)
                {
                    //We don't care about the outer exception
                    string msg = ex.InnerException.Message;
                    MessageBox.Show(this, string.Format(Strings.ConnectionFailedError, msg), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                catch (Exception ex)
                {
                    string msg = NestedExceptionMessageProcessor.GetFullMessage(ex);
                    MessageBox.Show(this, string.Format(Strings.ConnectionFailedError, msg), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #42
0
 private string GetPartialConnectionString()
 {
     var builder = new System.Data.Common.DbConnectionStringBuilder();
     foreach (DataGridViewRow row in grdConnectionParameters.Rows)
     {
         if (row.Cells[0].Value != null && row.Cells[1].Value != null)
         {
             if (!string.IsNullOrEmpty(row.Cells[1].Value.ToString()))
                 builder[row.Cells[0].Value.ToString()] = row.Cells[1].Value;
         }
     }
     return builder.ToString();
 }
    public override CartoDatasource ToDatasource(ParameterCollection parameters)
    {
      CartoDatasource ds = new CartoDatasource();

      if (parameters != null)
      {
        string type = parameters.GetValue("Type");
        string paramValue = null;

        switch (type.ToLower())
        {
          case "shape":
            if (parameters.TryGetValue("File", out paramValue))
            {
              if (paramValue.EndsWith(".shp"))
                ds.Add("type", type.ToLower());
            }
            else
              throw new Exception("'File' parameter is required.");

            ds.Add("file", paramValue);
            if (parameters.TryGetValue("FileBasedIndex", out paramValue))
              ds.Add("indexed", paramValue.ToLower());
            if (parameters.TryGetValue("Encoding", out paramValue))
              ds.Add("encoding", paramValue.ToLower());
            break;
          case "geojson":
            // ds.Add("type", type.ToLower());
            if (parameters.TryGetValue("File", out paramValue))
              ds.Add("file", paramValue);
            else
              throw new Exception("'File' parameter is required.");

            if (parameters.TryGetValue("FileBasedIndex", out paramValue))
              ds.Add("indexed", paramValue.ToLower());
            if (parameters.TryGetValue("Encoding", out paramValue) && !string.Equals(paramValue, "UTF-8", StringComparison.OrdinalIgnoreCase))
              ds.Add("encoding", paramValue.ToLower());
            break;
          case "ogr":
            ds.Add("type", type.ToLower());
            if (parameters.TryGetValue("File", out paramValue))
              ds.Add("file", paramValue);
            else
              throw new Exception("'File' parameter is required.");

            if (ds.TryGetValue("LayerName", out paramValue))
              ds.Add("layer", paramValue);
            break;
          case "postgis":
            ds.Add("type", type.ToLower());

            if (parameters.TryGetValue("Connection", out paramValue) && !string.IsNullOrEmpty(paramValue))
            {
              System.Data.Common.DbConnectionStringBuilder connParams = new System.Data.Common.DbConnectionStringBuilder();
              connParams.ConnectionString = paramValue;
              if (connParams.ContainsKey("Host") && !string.Equals(connParams["Host"], "localhost"))
                ds.Add("host", connParams["Host"]);
              if (connParams.ContainsKey("Port") && !string.Equals(connParams["Port"], "5432"))
                ds.Add("port", connParams["Port"]);
              if (connParams.ContainsKey("Database"))
                ds.Add("dbname", connParams["Database"]);

              if (connParams.ContainsKey("User ID") && !string.IsNullOrEmpty((string)connParams["User ID"]))
                ds.Add("user", connParams["User ID"]);

              if (connParams.ContainsKey("Password") && !string.IsNullOrEmpty((string)connParams["Password"]))
                ds.Add("password", connParams["Password"]);
            }

            if (parameters.TryGetValue("Extent", out paramValue))
              ds.Add("extent", paramValue);

            if (parameters.TryGetValue("Table_Origin", out paramValue))
              ds.Add("table", paramValue);
            if (parameters.TryGetValue("Query", out paramValue))
              ds.Add("table", paramValue);
            else if (parameters.TryGetValue("Table", out paramValue))
              ds.Add("table", paramValue);


            if (parameters.TryGetValue("GeometryField", out paramValue))
              ds.Add("geometry_field", paramValue);
            break;
          case "mssqlspatial":
            ds.Add("type", type.ToLower());

            if (parameters.TryGetValue("Connection", out paramValue))
              ds.Add("connection", paramValue);
            if (parameters.TryGetValue("GeometryField", out paramValue))
              ds.Add("geometry_field", paramValue);
            if (parameters.TryGetValue("Table", out paramValue))
              ds.Add("table", paramValue);
            if (parameters.TryGetValue("Query", out paramValue) && !string.IsNullOrEmpty(paramValue))
              ds.Add("query", paramValue);
            if (parameters.TryGetValue("SpatialIndex", out paramValue) && !string.IsNullOrEmpty(paramValue))
              ds.Add("spatial_index", paramValue);
            if (parameters.TryGetValue("Extent", out paramValue))
              ds.Add("extent", paramValue);
            break;
          case "spatialite":
            ds.Add("type", type.ToLower());

            if (parameters.TryGetValue("Connection", out paramValue))
              ds.Add("connection", paramValue);
            if (parameters.TryGetValue("GeometryField", out paramValue))
              ds.Add("geometry_field", paramValue);
            if (parameters.TryGetValue("Table", out paramValue))
              ds.Add("table", paramValue);
            if (parameters.TryGetValue("Query", out paramValue))
              ds.Add("query", paramValue);
            if (parameters.TryGetValue("Extent", out paramValue))
              ds.Add("extent", paramValue);
            break;
          case "dem":
            ds.Add("type", type.ToLower());

            if (parameters.TryGetValue("Path", out paramValue))
              ds.Add("path", paramValue);
            if (parameters.TryGetValue("DataSourceType", out paramValue))
              ds.Add("datasource_type", paramValue);
            if (parameters.TryGetValue("CacheSize", out paramValue))
              ds.Add("cache_size", paramValue);
            if (parameters.TryGetValue("FileExtension", out paramValue))
              ds.Add("file_extension", paramValue);
            if (parameters.TryGetValue("DataType", out paramValue))
              ds.Add("data_type", paramValue);
            if (parameters.TryGetValue("IsolineInterval", out paramValue))
              ds.Add("isoline_interval", paramValue);
            if (parameters.TryGetValue("MinElevation", out paramValue))
              ds.Add("min_elevation", paramValue);
            if (parameters.TryGetValue("MaxElevation", out paramValue))
              ds.Add("max_elevation", paramValue);
            if (parameters.TryGetValue("RestoreData", out paramValue))
              ds.Add("restore_data", paramValue);
            if (parameters.TryGetValue("ResampleAlgorithm", out paramValue))
              ds.Add("resampling_algorithm", paramValue);
            if (parameters.TryGetValue("AutoResolution", out paramValue))
              ds.Add("auto_resolution", paramValue);
            if (parameters.TryGetValue("DownsampleResolution", out paramValue))
              ds.Add("downsample_resolution", paramValue);
            if (parameters.TryGetValue("CacheID", out paramValue))
              ds.Add("cache_id", paramValue);
            break;
          case "osm":
            ds.Add("type", type.ToLower());
            if (parameters.TryGetValue("File", out paramValue))
              ds.Add("file", paramValue);
            else
              throw new Exception("'File' parameter is required.");

            if (parameters.TryGetValue("Query", out paramValue))
              ds.Add("query", paramValue);
            if (parameters.TryGetValue("TagsFilter", out paramValue))
              ds.Add("tags_filter", paramValue);
            if (parameters.TryGetValue("BuildSpatialIndex", out paramValue) && !string.IsNullOrEmpty(paramValue))
              ds.Add("spatial_index", paramValue.ToLower());
            if (parameters.TryGetValue("FileBasedIndex", out paramValue) && !string.IsNullOrEmpty(paramValue))
              ds.Add("spatial_index_file", paramValue.ToLower());
            break;
          case "esrifilegeodb":
            ds.Add("type", type.ToLower());

            if (parameters.TryGetValue("Path", out paramValue))
              ds.Add("path", paramValue);
            if (parameters.TryGetValue("Table", out paramValue))
              ds.Add("table", paramValue);
            if (parameters.TryGetValue("Query", out paramValue))
              ds.Add("query", paramValue);
            break;
        }
      }

      return ds;
    }
Example #44
0
 private string GetPartialConnectionStringForDataStoreEnumeration()
 {
     var builder = new System.Data.Common.DbConnectionStringBuilder();
     builder["Service"] = _fs.GetConnectionProperty("Service"); //NOXLATE
     builder["Username"] = txtUsername.Text; //_fs.GetConnectionProperty("Username"); //NOXLATE
     builder["Password"] = txtPassword.Text; //_fs.GetConnectionProperty("Password"); //NOXLATE
     return builder.ToString();
 }