本文整理汇总了C#中FdoToolbox.Core.Feature.FdoConnection类的典型用法代码示例。如果您正苦于以下问题:C# FdoConnection类的具体用法?C# FdoConnection怎么用?C# FdoConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FdoConnection类属于FdoToolbox.Core.Feature命名空间,在下文中一共展示了FdoConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FdoAggregateQueryCtl
public FdoAggregateQueryCtl(FdoConnection conn)
: this()
{
_conn = conn;
_presenter = new FdoAggregateQueryPresenter(this, conn);
joinCriteriaCtrl.Connection = conn;
}
示例2: Execute
/// <summary>
/// Copies all spatial contexts
/// </summary>
/// <param name="spatialContexts">The spatial contexts.</param>
/// <param name="target">The target.</param>
/// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
public override void Execute(ICollection<SpatialContextInfo> spatialContexts, FdoConnection target, bool overwrite)
{
//MySQL supports multiple spatial contexts and IDestorySpatialContext
//so in this case if overwrite == true, we want to destroy any ones that
//already exist in the target before creating new ones in its place. This does not
//prevent creating a series of spatial contexts if overwrite == false and one of
//the spatial contexts being copied already exists. This is an unfortunate leaky
//abstraction in the FDO API.
using (FdoFeatureService service = target.CreateFeatureService())
{
if (overwrite)
{
ReadOnlyCollection<SpatialContextInfo> targetContexts = service.GetSpatialContexts();
foreach (SpatialContextInfo sc in spatialContexts)
{
//Only destroy spatial context if it exists in target connection
if (SpatialContextExists(targetContexts, sc))
service.DestroySpatialContext(sc);
}
}
foreach (SpatialContextInfo sc in spatialContexts)
{
service.CreateSpatialContext(sc, false);
}
}
}
示例3: SchemaDesignContext
public SchemaDesignContext(FdoConnection conn)
{
_spatialContexts = new BindingList<SpatialContextInfo>();
if (conn == null)
{
_schemas = new FeatureSchemaCollection(null);
_mappings = new PhysicalSchemaMappingCollection();
}
else
{
using (var svc = conn.CreateFeatureService())
{
_schemas = svc.DescribeSchema();
_mappings = svc.DescribeSchemaMapping(true);
if (_mappings == null)
_mappings = new PhysicalSchemaMappingCollection();
var spatialContexts = svc.GetSpatialContexts();
foreach (var sc in spatialContexts)
{
_spatialContexts.Add(sc);
}
}
}
this.Connection = conn;
EvaluateCapabilities();
}
示例4: CreateConnection
/// <summary>
/// Creates the connection.
/// </summary>
/// <param name="provider">The provider.</param>
/// <param name="connStr">The connection string.</param>
/// <param name="configPath">The configuration path</param>
/// <param name="name">The name that will be assigned to the connection.</param>
/// <returns></returns>
protected override FdoConnection CreateConnection(string provider, string connStr, string configPath, ref string name)
{
IFdoConnectionManager connMgr = ServiceManager.Instance.GetService<IFdoConnectionManager>();
//Try to find by name first
FdoConnection conn = null;
conn = connMgr.GetConnection(name);
//Named connection matches all the details
if (conn != null)
{
if (conn.Provider == provider && conn.ConnectionString == connStr)
return conn;
}
//Then to find matching open connection
foreach (string connName in connMgr.GetConnectionNames())
{
FdoConnection c = connMgr.GetConnection(connName);
if (c.Provider == provider && c.ConnectionString == connStr)
{
name = connName;
return c;
}
}
//Make a new connection
LoggingService.Info(ResourceService.GetString("INFO_REFERENCED_CONNECTION_NOT_FOUND"));
conn = new FdoConnection(provider, connStr);
if (!string.IsNullOrEmpty(configPath) && System.IO.File.Exists(configPath))
conn.SetConfiguration(configPath);
connMgr.AddConnection(name, conn);
return conn;
}
示例5: FdoBulkUpdatePresenter
public FdoBulkUpdatePresenter(IFdoBulkUpdateView view, FdoConnection conn, string className)
{
_view = view;
_conn = conn;
_className = className;
_view.Title = ICSharpCode.Core.ResourceService.GetString("TITLE_BULK_UPDATE_FEATURE");
}
示例6: TestConnection
public void TestConnection()
{
FdoProviderInfo provider = _view.SelectedProvider;
string connStr = ExpressUtility.ConvertFromNameValueCollection(_view.ConnectProperties);
FdoConnection conn = new FdoConnection(provider.Name, connStr);
try
{
FdoConnectionState state = conn.Open();
if (state == FdoConnectionState.Open || state == FdoConnectionState.Pending)
{
_view.ShowMessage(null, "Test successful");
conn.Close();
}
else
{
_view.ShowError("Connection test failed");
}
}
catch (FdoException ex)
{
_view.ShowError(ex.InnerException.Message);
}
finally
{
conn.Dispose();
}
}
示例7: FdoCopySpatialContextOperation
/// <summary>
/// Initializes a new instance of the <see cref="FdoCopySpatialContextOperation"/> class.
/// </summary>
/// <param name="src">The source connection.</param>
/// <param name="dst">The target connection.</param>
/// <param name="sourceSpatialContextNames">The source spatial context names.</param>
/// <param name="overwrite">if set to <c>true</c> [overwrite].</param>
public FdoCopySpatialContextOperation(FdoConnection src, FdoConnection dst, string[] sourceSpatialContextNames, bool overwrite)
{
_source = src;
_target = dst;
_scNames = sourceSpatialContextNames;
_overwrite = overwrite;
}
示例8: Execute
/// <summary>
/// Copies the spatial contexts given in the list
/// </summary>
/// <param name="source">The source connection</param>
/// <param name="target">The target connection</param>
/// <param name="overwrite">If true will overwrite any existing spatial contexts</param>
/// <param name="spatialContextNames">The list of spatial contexts to copy</param>
public override void Execute(FdoConnection source, FdoConnection target, bool overwrite, string[] spatialContextNames)
{
if (spatialContextNames.Length == 0)
return;
FdoFeatureService srcService = source.CreateFeatureService();
FdoFeatureService destService = target.CreateFeatureService();
ReadOnlyCollection<SpatialContextInfo> srcContexts = srcService.GetSpatialContexts();
ReadOnlyCollection<SpatialContextInfo> destContexts = destService.GetSpatialContexts();
foreach (SpatialContextInfo ctx in srcContexts)
{
if (SpatialContextInSpecifiedList(ctx, spatialContextNames))
{
try
{
//Find target spatial context of the same name
SpatialContextInfo sci = destService.GetSpatialContext(ctx.Name);
if (sci != null && overwrite)
{
//If found, destroy then create
destService.DestroySpatialContext(ctx.Name);
destService.CreateSpatialContext(ctx, false);
}
else
{
destService.CreateSpatialContext(ctx, false);
}
}
catch (Exception)
{
}
}
}
}
示例9: FdoAggregateQueryPresenter
public FdoAggregateQueryPresenter(IFdoAggregateQueryView view, FdoConnection conn)
{
_view = view;
_conn = conn;
_service = _conn.CreateFeatureService();
_view.OrderingEnabled = false;
_walker = SchemaWalker.GetWalker(conn);
}
示例10: FdoSpatialContextBrowserDlg
public FdoSpatialContextBrowserDlg(FdoConnection conn)
: this()
{
using (FdoFeatureService service = conn.CreateFeatureService())
{
grdSpatialContexts.DataSource = service.GetSpatialContexts();
}
}
示例11: FdoJoinDialog
public FdoJoinDialog(FdoConnection conn, string primarySchemaName, string primaryClassName, string primaryClassAlias)
{
InitializeComponent();
_conn = conn;
_primarySchemaName = primarySchemaName;
_primaryClassName = primaryClassName;
_primaryClassAlias = primaryClassAlias;
}
示例12: TestCopyTaskMsSql
public void TestCopyTaskMsSql()
{
MockRepository mocks = new MockRepository();
FdoConnection conn = new FdoConnection("OSGeo.SQLServerSpatial", "");
ICopySpatialContext ctx = CopySpatialContextOverrideFactory.GetCopySpatialContextOverride(conn);
Assert.IsTrue(ctx is MsSqlCopySpatialContextOverride);
}
示例13: FdoSqlOutputOperation
public FdoSqlOutputOperation(FdoConnection conn, string className, NameValueCollection propertyMappings)
: base(conn, className, propertyMappings)
{
if (!conn.Capability.GetBooleanCapability(CapabilityType.FdoCapabilityType_SupportsSQL))
{
throw new ArgumentException("Only providers that support SQL can be used");
}
}
示例14: ConnectArcSdePresenter
public ConnectArcSdePresenter(IConnectArcSdeView view, IFdoConnectionManager connMgr)
{
_view = view;
_connMgr = connMgr;
_conn = new FdoConnection("OSGeo.ArcSDE");
_view.DataStoreEnabled = false;
_view.SubmitEnabled = false;
}
示例15: DumpFeatureClassCtl
public DumpFeatureClassCtl(FdoConnection source, string schemaName, string className)
{
InitializeComponent();
this.Title = "Dump Feature Class";
_source = source;
_schemaName = schemaName;
_className = className;
}