Example #1
0
        public void Init()
        {
            _view.LeftConnections   = new List <string>(_connMgr.GetConnectionNames());
            _view.RightConnections  = new List <string>(_connMgr.GetConnectionNames());
            _view.TargetConnections = new List <string>(_connMgr.GetConnectionNames());

            ConnectionChanged(JoinSourceType.Left);
            ConnectionChanged(JoinSourceType.Right);
            ConnectionChanged(JoinSourceType.Target);

            _init = true;
            SetTargetGeometries();

            GeometryPropertyCheckChanged();
        }
        public void Init()
        {
            List <string> names = new List <string>(_connMgr.GetConnectionNames());

            names.Remove(_view.SourceConnectionName);

            _view.TargetConnectionNames = names;
            FdoConnection conn = _connMgr.GetConnection(_view.SourceConnectionName);

            using (FdoFeatureService service = conn.CreateFeatureService())
            {
                ICollection <SpatialContextInfo> contexts = service.GetSpatialContexts();
                List <string> scn = new List <string>();
                foreach (SpatialContextInfo sc in contexts)
                {
                    scn.Add(sc.Name);
                }
                _view.SpatialContexts = scn;
            }
        }
Example #3
0
        /// <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);
        }