public virtual void ConnectionClosed( DbConnection connection, ConnectionEndEventData eventData) { Assert.False(eventData.IsAsync); SyncCalled = true; AssertClosed(eventData); }
public void ConnectionOpened( DbConnection connection, ConnectionEndEventData eventData) { for (var i = 0; i < _interceptors.Length; i++) { _interceptors[i].ConnectionOpened(connection, eventData); } }
public async Task ConnectionClosedAsync( DbConnection connection, ConnectionEndEventData eventData) { for (var i = 0; i < _interceptors.Length; i++) { await _interceptors[i].ConnectionClosedAsync(connection, eventData); } }
public override Task ConnectionOpenedAsync( DbConnection connection, ConnectionEndEventData eventData, CancellationToken cancellationToken = default) { this.RegisterCustomTypeMappers((NpgsqlConnection)connection); return(Task.CompletedTask); }
public virtual Task ConnectionClosedAsync( DbConnection connection, ConnectionEndEventData eventData) { Assert.True(eventData.IsAsync); AsyncCalled = true; AssertClosed(eventData); return(Task.CompletedTask); }
public async Task ConnectionOpenedAsync( DbConnection connection, ConnectionEndEventData eventData, CancellationToken cancellationToken = default) { for (var i = 0; i < _interceptors.Length; i++) { await _interceptors[i].ConnectionOpenedAsync(connection, eventData, cancellationToken); } }
public virtual Task ConnectionOpenedAsync( DbConnection connection, ConnectionEndEventData eventData, CancellationToken cancellationToken = default) { Assert.True(eventData.IsAsync); AsyncCalled = true; AssertOpened(eventData); return(Task.CompletedTask); }
private void HandleConnection(string name, ConnectionEndEventData eventData) { ConnectionMetric metric; if (name == RelationalEventId.ConnectionOpened.Name) { metric = new ConnectionMetric(eventData) { Action = "Open", ConnectionDelta = 1, Duration = eventData.Duration }; _connectionNames.TryAdd(eventData.ConnectionId, metric.InstanceName); } else if (name == RelationalEventId.ConnectionClosed.Name) { // *sigh*. We've found the server names don't always match between open and close //so look up our cached value.. if (_connectionNames.TryRemove(eventData.ConnectionId, out string instanceName)) { metric = new ConnectionMetric(eventData, instanceName) { Action = "Closed", ConnectionDelta = -1, Duration = eventData.Duration }; } else { // we ignore the else clause because it's not a "matching" event. return; } } else { return; } EventMetric.Write(metric); SampledMetric.Write(metric); }
/// <summary> /// </summary> /// <param name="connection"></param> /// <param name="eventData"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public override Task ConnectionOpenedAsync(DbConnection connection, ConnectionEndEventData eventData, CancellationToken cancellationToken = default) { return(base.ConnectionOpenedAsync(connection, eventData, cancellationToken)); }
public override void ConnectionClosed(DbConnection connection, ConnectionEndEventData eventData) { Assert.Equal(_goodConnectionString, eventData.Context.Database.GetConnectionString()); eventData.Context.Database.SetConnectionString(_dummyConnectionString); }
public override void ConnectionOpened(DbConnection connection, ConnectionEndEventData eventData) { this.RegisterCustomTypeMappers((NpgsqlConnection)connection); }
public override void ConnectionOpened(DbConnection connection, ConnectionEndEventData eventData) { base.ConnectionOpened(connection, eventData); }
public override async Task ConnectionClosedAsync(DbConnection connection, ConnectionEndEventData eventData) { await base.ConnectionClosedAsync(connection, eventData); }
/// <summary> /// </summary> /// <param name="connection"></param> /// <param name="eventData"></param> /// <returns></returns> public override Task ConnectionClosedAsync(DbConnection connection, ConnectionEndEventData eventData) { return(base.ConnectionClosedAsync(connection, eventData)); }
public Task ConnectionClosedAsync(DbConnection connection, ConnectionEndEventData eventData) { TrackEvent(nameof(ConnectionClosedAsync), connection, eventData.ConnectionId); RemoveOperationHolder(eventData.ConnectionId); return(Task.CompletedTask); }
public void ConnectionClosed(DbConnection connection, ConnectionEndEventData eventData) { TrackEvent(nameof(ConnectionClosed), connection, eventData.ConnectionId); RemoveOperationHolder(eventData.ConnectionId); }
public Task ConnectionOpenedAsync(DbConnection connection, ConnectionEndEventData eventData, CancellationToken cancellationToken = new CancellationToken()) { TrackEvent(nameof(ConnectionOpenedAsync), connection, eventData.ConnectionId); return(Task.CompletedTask); }
public void ConnectionOpened(DbConnection connection, ConnectionEndEventData eventData) { TrackEvent(nameof(ConnectionOpened), connection, eventData.ConnectionId); }
public override async Task ConnectionOpenedAsync(DbConnection connection, ConnectionEndEventData eventData, CancellationToken cancellationToken = new CancellationToken()) { await base.ConnectionOpenedAsync(connection, eventData, cancellationToken); }
public override void ConnectionClosed(DbConnection connection, ConnectionEndEventData eventData) { }