Exemplo n.º 1
0
        public string Serialize(T contents)
        {
            var message      = _contentsSerializer.Serialize(contents);
            var typedMessage = new TypedMessage(message, _type, _version);

            return(_messageSerializer.Serialize(typedMessage));
        }
Exemplo n.º 2
0
        private void AssertTypeAndSchema(TypedMessage message)
        {
            if (message.Type != _type)
            {
                throw new FormatException($"The provided message has the wrong type! Expected: {_type}, found {message.Type}");
            }

            if (message.Version != _version)
            {
                throw new FormatException($"The provided message has the wrong version! Expected: {_version}, found {message.Version}");
            }
        }