/// <summary> /// Gets the connect time property. /// </summary> /// <param name="name">The name.</param> /// <returns></returns> public DictionaryProperty GetConnectTimeProperty(string name) { if (this.State != FdoConnectionState.Open && this.State != FdoConnectionState.Pending) { throw new InvalidOperationException(Res.GetString("ERR_CONNECTION_NOT_OPEN")); } IConnectionPropertyDictionary dict = this.InternalConnection.ConnectionInfo.ConnectionProperties; bool enumerable = dict.IsPropertyEnumerable(name); DictionaryProperty dp = null; if (enumerable) { EnumerableDictionaryProperty ep = new EnumerableDictionaryProperty(); ep.Values = dict.EnumeratePropertyValues(name); dp = ep; } else { dp = new DictionaryProperty(); } dp.Name = name; dp.LocalizedName = dict.GetLocalizedName(name); dp.DefaultValue = dict.GetPropertyDefault(name); dp.Protected = dict.IsPropertyProtected(name); dp.Required = dict.IsPropertyRequired(name); return(dp); }
public PendingParameterDialog(IEnumerable <DictionaryProperty> properties) : this() { foreach (DictionaryProperty dp in properties) { if (dp.Enumerable) { EnumerableDictionaryProperty ep = dp as EnumerableDictionaryProperty; if (ep.Required) { this.AddRequiredEnumerableProperty(ep.Name, ep.DefaultValue, ep.Values); } else { this.AddOptionalEnumerableProperty(ep.Name, ep.DefaultValue, ep.Values); } } } }
public void PendingConnect() { try { if (_conn.State != FdoConnectionState.Closed) { _conn.Close(); } _conn.ConnectionString = string.Format("Server={0};Instance={1};Username={2};Password={3}", _view.Server, _view.Instance, _view.Username, _view.Password); if (_conn.Open() == FdoConnectionState.Pending) { EnumerableDictionaryProperty prop = (EnumerableDictionaryProperty)_conn.GetConnectTimeProperty("DataStore"); SetDataStore(prop.Values); } } catch (Exception ex) { _view.ShowError(ex.Message); } }
public void ProviderChanged() { FdoProviderInfo prov = _view.SelectedProvider; if (prov != null) { _view.ResetGrid(); _pendingProperties.Clear(); IList <DictionaryProperty> props = FdoFeatureService.GetConnectProperties(prov.Name); if (props != null) { foreach (DictionaryProperty p in props) { if (p.Enumerable) { EnumerableDictionaryProperty ep = p as EnumerableDictionaryProperty; if (!ep.RequiresConnection) { _view.AddEnumerableProperty(ep.Name, ep.DefaultValue, ep.Values); } else { _pendingProperties.Add(ep); } } else { _view.AddProperty(p); } } } using (var conn = FeatureAccessManager.GetConnectionManager().CreateConnection(prov.Name)) { _view.ConfigEnabled = conn.ConnectionCapabilities.SupportsConfiguration(); } } }
public OgrEsriPgbEditor() { box.SelectedIndexChanged += new EventHandler(OnSelectedIndexChanged); //Since ESRI PGB is basically a ODBC DSN, we get a free builder by just using //the DataSourceName property from the ODBC FDO Provider IList <DictionaryProperty> props = FdoFeatureService.GetConnectProperties("OSGeo.ODBC"); EnumerableDictionaryProperty dataSource = null; foreach (DictionaryProperty dp in props) { if (dp.Enumerable && dp.Name == "DataSourceName") { dataSource = (EnumerableDictionaryProperty)dp; } } if (dataSource != null) { box.SelectionMode = SelectionMode.One; box.DataSource = dataSource.Values; } }
public void ProviderChanged() { FdoProviderInfo prov = _view.SelectedProvider; if (prov != null) { _view.ResetDataStoreGrid(); IList <DictionaryProperty> dprops = FdoFeatureService.GetCreateDataStoreProperties(prov.Name); if (dprops != null) { foreach (DictionaryProperty p in dprops) { if (p.Enumerable) { EnumerableDictionaryProperty ep = p as EnumerableDictionaryProperty; if (!ep.RequiresConnection) { _view.AddEnumerableDataStoreProperty(ep.Name, ep.DefaultValue, ep.Values); } } else { _view.AddDataStoreProperty(p); } } _view.CreateEnabled = true; } else { _view.ShowError("Selected provider does not support creation of data stores"); _view.ResetDataStoreGrid(); _view.ResetConnectGrid(); _view.CreateEnabled = false; return; } if (!prov.IsFlatFile) { _view.ResetConnectGrid(); IList <DictionaryProperty> cprops = FdoFeatureService.GetConnectProperties(prov.Name); if (cprops != null) { foreach (DictionaryProperty p in cprops) { if (p.Enumerable) { EnumerableDictionaryProperty ep = p as EnumerableDictionaryProperty; if (!ep.RequiresConnection) { _view.AddEnumerableConnectProperty(ep.Name, ep.DefaultValue, ep.Values); } } else { _view.AddConnectProperty(p); } } } } } }