Пример #1
0
        private bool AuditEventEnabled(SignalrEventBase @event)
        {
            switch (@event.GetType().Name)
            {
            case nameof(SignalrEventIncoming):
                return(IncomingEventsFilter?.Invoke(@event as SignalrEventIncoming) ?? true);

            case nameof(SignalrEventOutgoing):
                return(OutgoingEventsFilter?.Invoke(@event as SignalrEventOutgoing) ?? true);

            case nameof(SignalrEventConnect):
                return(ConnectEventsFilter?.Invoke(@event as SignalrEventConnect) ?? true);

            case nameof(SignalrEventDisconnect):
                return(DisconnectEventsFilter?.Invoke(@event as SignalrEventDisconnect) ?? true);

            case nameof(SignalrEventReconnect):
                return(ReconnectEventsFilter?.Invoke(@event as SignalrEventReconnect) ?? true);

            case nameof(SignalrEventError):
                return(ErrorEventsFilter?.Invoke(@event as SignalrEventError) ?? true);

            default:
                return(true);
            }
        }
Пример #2
0
        private AuditScope CreateAuditScope(SignalrEventBase signalrEvent)
        {
            var auditEvent = new AuditEventSignalr()
            {
                Event = signalrEvent
            };
            var scope = AuditScope.Create(new AuditScopeOptions()
            {
                EventType      = (AuditEventType ?? "{event}").Replace("{event}", signalrEvent.EventType.ToString()),
                AuditEvent     = auditEvent,
                CreationPolicy = CreationPolicy,
                DataProvider   = AuditDataProvider
            });

            return(scope);
        }