public override async ValueTask DetachAsync(CancellationToken cancellationToken = default)
    {
        try
        {
            await _database.Xdr.WriteAsync(IscCodes.op_service_detach, cancellationToken).ConfigureAwait(false);

            await _database.Xdr.WriteAsync(Handle, cancellationToken).ConfigureAwait(false);

            await _database.Xdr.WriteAsync(IscCodes.op_disconnect, cancellationToken).ConfigureAwait(false);

            await _database.Xdr.FlushAsync(cancellationToken).ConfigureAwait(false);

            Handle = 0;
        }
        catch (IOException ex)
        {
            throw IscException.ForIOException(ex);
        }
        finally
        {
            try
            {
                await _connection.DisconnectAsync(cancellationToken).ConfigureAwait(false);
            }
            catch (IOException ex)
            {
                throw IscException.ForIOException(ex);
            }
            finally
            {
                _database   = null;
                _connection = null;
            }
        }
    }
    public override void Detach()
    {
        try
        {
            _database.Xdr.Write(IscCodes.op_service_detach);
            _database.Xdr.Write(Handle);
            _database.Xdr.Write(IscCodes.op_disconnect);
            _database.Xdr.Flush();

            Handle = 0;
        }
        catch (IOException ex)
        {
            throw IscException.ForIOException(ex);
        }
        finally
        {
            try
            {
                _connection.Disconnect();
            }
            catch (IOException ex)
            {
                throw IscException.ForIOException(ex);
            }
            finally
            {
                _database   = null;
                _connection = null;
            }
        }
    }
Ejemplo n.º 3
0
    public async ValueTask OpenAsync(CancellationToken cancellationToken = default)
    {
        var connection = new GdsConnection(_ipAddress, _portNumber, _timeout);
        await connection.ConnectAsync(cancellationToken).ConfigureAwait(false);

        _database = new GdsDatabase(connection);
    }
Ejemplo n.º 4
0
    public void Open()
    {
        var connection = new GdsConnection(_ipAddress, _portNumber, _timeout);

        connection.Connect();
        _database = new GdsDatabase(connection);
    }
Ejemplo n.º 5
0
    public GdsTransaction(DatabaseBase db)
    {
        if (!(db is GdsDatabase))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(GdsDatabase)} type.");
        }

        _database = (GdsDatabase)db;
        State     = TransactionState.NoTransaction;
    }
Ejemplo n.º 6
0
 public override async ValueTask Dispose2Async(CancellationToken cancellationToken = default)
 {
     if (!_disposed)
     {
         _disposed = true;
         if (State != TransactionState.NoTransaction)
         {
             await RollbackAsync(cancellationToken).ConfigureAwait(false);
         }
         _database = null;
         _handle   = 0;
         State     = TransactionState.NoTransaction;
         await base.Dispose2Async(cancellationToken).ConfigureAwait(false);
     }
 }
Ejemplo n.º 7
0
 public override void Dispose2()
 {
     if (!_disposed)
     {
         _disposed = true;
         if (State != TransactionState.NoTransaction)
         {
             Rollback();
         }
         _database = null;
         _handle   = 0;
         State     = TransactionState.NoTransaction;
         base.Dispose2();
     }
 }
Ejemplo n.º 8
0
    public GdsArray(DatabaseBase db, TransactionBase transaction, long handle, string tableName, string fieldName)
        : base(tableName, fieldName)
    {
        if (!(db is GdsDatabase))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(GdsDatabase)} type.");
        }

        if (!(transaction is GdsTransaction))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(GdsTransaction)} type.");
        }

        _database    = (GdsDatabase)db;
        _transaction = (GdsTransaction)transaction;
        _handle      = handle;
    }
    public GdsBlob(DatabaseBase db, TransactionBase transaction, long blobId)
        : base(db)
    {
        if (!(db is GdsDatabase))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(GdsDatabase)} type.");
        }
        if (!(transaction is GdsTransaction))
        {
            throw new ArgumentException($"Specified argument is not of {nameof(GdsTransaction)} type.");
        }

        _database    = (GdsDatabase)db;
        _transaction = transaction;
        _position    = 0;
        _blobHandle  = 0;
        _blobId      = blobId;
    }
 public GdsServiceManager(GdsConnection connection)
 {
     _connection = connection;
     _database   = CreateDatabase(_connection);
     RewireWarningMessage();
 }