protected async void ProcessEntityChange(EntityEvent entityEvent)
        {
            object entity = await GetEntity(entityEvent.EntityType, entityEvent.EntityId);

            List<string> groups = new List<string>();
            groups.Add(entityEvent.EntityType);
            groups.Add($"{entityEvent.EntityType}.{entityEvent.EntityId}");
            foreach (RelatedEntityInfo relatedEntityInfo in entityEvent.RelatedEntityInfo)
            {
                groups.Add($"{relatedEntityInfo.TypeName}.{relatedEntityInfo.EntityId}.{relatedEntityInfo.RelationName}");
            }

            switch (entityEvent.EventType)
            {
                case EntityEvent.EntityEventType.ADD:
                    PublishSignalrNewEntityEvent(groups, entityEvent.EntityType, entityEvent.EntityId, entity);
                    break;
                case EntityEvent.EntityEventType.UPDATE:
                    PublishSignalrUpdatedEntityEvent(groups, entityEvent.EntityType, entityEvent.EntityId, entity);
                    break;
                case EntityEvent.EntityEventType.DELETE:
                    PublishSignalrDeletedEntityEvent(groups, entityEvent.EntityType, entityEvent.EntityId, entity);
                    break;
            }
        }
Exemplo n.º 2
0
 public EntityEventArgs(EntityEvent evtData)
 {
     this.EntityEventData = evtData;
 }