Пример #1
0
 internal SharedErrorEventArgs(ErrorPayload data)
 {
     this.Error = data.Error;
     this.Name = data.Name;
     this.Description = data.Description;
     this.SourceId = data.ClientId;
 }
Пример #2
0
        public static Payload CreateInstance(IPayloadReader reader)
        {
            PayloadType type = (PayloadType)reader.ReadByte("PayloadType");

            Payload payload = null;
            switch (type)
            {
                case PayloadType.CollectionOpened:
                    payload = new CollectionOpenedPayload();
                    break;

                case PayloadType.ObjectOpened:
                    payload = new ObjectOpenedPayload();
                    break;
                case PayloadType.ObjectDeleted:
                    payload = new ObjectDeletedPayload();
                    break;

                case PayloadType.ObjectClosed:
                    payload = new ObjectClosedPayload();
                    break;

                case PayloadType.ObjectConnected:
                    payload = new ObjectConnectedPayload();
                    break;

                case PayloadType.CollectionDeleted:
                    payload = new CollectionDeletedPayload();
                    break;

                case PayloadType.Object:
                    payload = new ObjectPayload();
                    break;

                case PayloadType.ObjectInserted:
                    payload = new ObjectInsertedPayload();
                    break;

                case PayloadType.ObjectRemoved:
                    payload = new ObjectRemovedPayload();
                    break;

                case PayloadType.PropertyUpdated:
                    payload = new PropertyChangedPayload();
                    break;

                case PayloadType.RegisterClient:
                    payload = new ClientConnectPayload();
                    break;

                case PayloadType.RegisterPrincipal:
                    payload = new RegisterPrincipalPayload();
                    break;

                case PayloadType.CollectionConnected:
                    payload = new CollectionConnectedPayload();
                    break;

                case PayloadType.CollectionClosed:
                    payload = new CollectionClosedPayload();
                    break;

                case PayloadType.SingletonInitialized:
                    payload = new SingletonInitializedPayload();
                    break;

                case PayloadType.ObjectError:
                    payload = new ObjectErrorPayload();
                    break;

                case PayloadType.ObjectPropertyError:
                    payload = new ObjectPropertyErrorPayload();
                    break;

                case PayloadType.Error:
                    payload = new ErrorPayload();
                    break;

                case PayloadType.Trace:
                    payload = new TracePayload();
                    break;
#if SERVER_COMMAND_USED
                case PayloadType.ServerCommand:
                    payload = new ServerCommandPayload();
                    break;
#endif
                case PayloadType.AtomicOperation:
                    payload = new AtomicPayload();
                    break;

                case PayloadType.UnauthorizedError:
                    payload = new UnauthorizedErrorPayload();
                    break;

                case PayloadType.ObjectSecurity:
                    payload = new SharedObjectSecurityPayload();
                    break;

                case PayloadType.DirectMessage:
                    payload = new MessagePayload();
                    break;

                //case PayloadType.CollectionHeartbeat:
                //    payload = new CollectionHeartbeatPayload();
                //    break;

                case PayloadType.EvictionPolicy:
                    payload = new EvictionPolicyPayload();
                    break;

                default:
                    throw new InvalidOperationException("Unknown EventLinkDataType");

            }

            // Deserialize the payload data
            payload.Deserialize(reader);

            return payload;
        }