예제 #1
0
파일: Part.cs 프로젝트: jpdrude/DisCo-Code
 public void SetInactive(int conID)
 {
     if (ActiveConnections.Contains(conID) && connections.Count > conID)
     {
         activeConnections.Remove(conID);
         ConnectionVoxelContainer.RemoveConnection(connections[conID]);
     }
 }
예제 #2
0
파일: Part.cs 프로젝트: jpdrude/DisCo-Code
 public void SetActive(int conID)
 {
     if (!ActiveConnections.Contains(conID) && connections.Count > conID && conID >= 0)
     {
         activeConnections.Add(conID);
         ConnectionVoxelContainer.StoreConnection(connections[conID]);
     }
 }
예제 #3
0
        /// <summary>
        /// create a new managed connection.
        /// </summary>
        /// <param name="connection">connection</param>
        /// <param name="attemptToPool">true if we are going to try and reuse the
        /// connection if possible</param>
        public ManagedConnection(SqlOlapConnectionInfoBase sourceConnection, bool attemptToPool)
        {
            // parameter check
            if (sourceConnection == null)
            {
                throw new ArgumentNullException("sourceConnection");
            }

            // see if the connection can restrict access (single user mode)
            IRestrictedAccess access = sourceConnection as IRestrictedAccess;
            // see if it is cloneable
            ICloneable cloneable = sourceConnection as ICloneable;

            lock (ActiveConnections)
            {
                // if it's not single user mode then we can see if the object can be cloned
                if (access == null || access.SingleConnection == false)
                {
                    // if we are going to attempt to pool, see if the connection is in use
                    if (attemptToPool && !ActiveConnections.Contains(SharedConnectionUtil.GetConnectionKeyName(sourceConnection)))
                    {
                        // add it to the hashtable to indicate use.
                        ActiveConnections.Add(SharedConnectionUtil.GetConnectionKeyName(sourceConnection), sourceConnection);
                        this.connection     = sourceConnection;
                        this.closeOnDispose = false;
                        this.connectionAddedToActiveConnections = true;
                    }
                    else if (cloneable != null)
                    {
                        this.connection     = (SqlOlapConnectionInfoBase)cloneable.Clone();
                        this.closeOnDispose = true;
                    }
                    else if (sourceConnection is SqlConnectionInfoWithConnection)
                    {
                        this.connection     = ((SqlConnectionInfoWithConnection)sourceConnection).Copy();
                        this.closeOnDispose = true;
                    }
                }
            }
            // if everything else has failed just use to passed in connection.
            if (this.connection == null)
            {
                this.connection = sourceConnection;
            }

            // always set the lock timeout to prevent the shell from not responding
            if (this.connection is SqlConnectionInfoWithConnection)
            {
                // set lock_timeout to 10 seconds
                ((SqlConnectionInfoWithConnection)this.connection).ServerConnection.LockTimeout = 10;
            }
        }
예제 #4
0
파일: Part.cs 프로젝트: ar0551/DisCo
    public void SetInactive(Connection c)
    {
        int i = 0;

        foreach (Connection con in Connections)
        {
            if (c == con)
            {
                if (ActiveConnections.Contains(i))
                {
                    activeConnections.Remove(i);
                }
            }
            ++i;
        }
    }
예제 #5
0
파일: Part.cs 프로젝트: ar0551/DisCo
    public void SetActive(Connection c)
    {
        int i = 0;

        foreach (Connection con in Connections)
        {
            if (c == con)
            {
                if (!ActiveConnections.Contains(i))
                {
                    activeConnections.Add(i);
                }
            }
            ++i;
        }
    }
예제 #6
0
파일: Part.cs 프로젝트: jpdrude/DisCo-Code
    public void SetActive(Connection c)
    {
        int i = 0;

        foreach (Connection con in Connections)
        {
            if (c == con)
            {
                if (!ActiveConnections.Contains(i))
                {
                    activeConnections.Add(i);
                    ConnectionVoxelContainer.StoreConnection(con);
                    return;
                }
            }
            ++i;
        }
    }
예제 #7
0
파일: Part.cs 프로젝트: jpdrude/DisCo-Code
    public void SetInactive(Connection c)
    {
        int i = 0;

        foreach (Connection con in Connections)
        {
            if (c == con)
            {
                if (ActiveConnections.Contains(i))
                {
                    activeConnections.Remove(i);

                    ConnectionVoxelContainer.RemoveConnection(con);
                    return;
                }
            }
            ++i;
        }
    }