public static ICanCreateEndpointAsClientOrServer <TMessage, TCommand, TEvent, TRequest, TResponse> SerializedAsProtoBuf <TMessage, TCommand, TEvent, TRequest, TResponse>(
     this ICanSpecifyEndpointSerializers <TMessage, TCommand, TEvent, TRequest, TResponse> config,
     RuntimeTypeModel model = null)
     where TMessage : class
     where TCommand : class, TMessage
     where TEvent : class, TMessage
     where TRequest : class, TMessage
     where TResponse : class, TMessage
 {
     return(config.SerializedWith(new ProtoBufMessageSerializer(model), new ProtoBufMessageDeserializerFactory(model)));
 }
 /// <summary>
 /// Overload prevents having to explicitly reference MessagePack-CSharp in user code.
 /// </summary>
 /// <typeparam name="TMessage"></typeparam>
 /// <typeparam name="TCommand"></typeparam>
 /// <typeparam name="TEvent"></typeparam>
 /// <typeparam name="TRequest"></typeparam>
 /// <typeparam name="TResponse"></typeparam>
 /// <param name="config"></param>
 /// <returns></returns>
 public static ICanCreateEndpointAsClientOrServer <TMessage, TCommand, TEvent, TRequest, TResponse> SerializedAsMessagePackCSharp <TMessage, TCommand, TEvent, TRequest, TResponse>(
     this ICanSpecifyEndpointSerializers <TMessage, TCommand, TEvent, TRequest, TResponse> config)
     where TMessage : class
     where TCommand : class, TMessage
     where TEvent : class, TMessage
     where TRequest : class, TMessage
     where TResponse : class, TMessage
 {
     // ReSharper disable once IntroduceOptionalParameters.Global
     return(SerializedAsMessagePackCSharp(config, MessagePackSerializer.DefaultResolver));
 }
 public static ICanCreateEndpointAsClientOrServer <TMessage, TCommand, TEvent, TRequest, TResponse> SerializedAsMessagePackCSharp <TMessage, TCommand, TEvent, TRequest, TResponse>(
     this ICanSpecifyEndpointSerializers <TMessage, TCommand, TEvent, TRequest, TResponse> config,
     IFormatterResolver resolver)
     where TMessage : class
     where TCommand : class, TMessage
     where TEvent : class, TMessage
     where TRequest : class, TMessage
     where TResponse : class, TMessage
 {
     return(config.SerializedWith(new MessagePackCSharpMessageSerializer(resolver), new MessagePackCSharpMessageDeserializerFactory(resolver)));
 }
Example #4
0
 public static ICanCreateEndpointAsClientOrServer <TMessage, TCommand, TEvent, TRequest, TResponse> SerializedAsYaml <TMessage, TCommand, TEvent, TRequest, TResponse>(
     this ICanSpecifyEndpointSerializers <TMessage, TCommand, TEvent, TRequest, TResponse> config)
     where TMessage : class
     where TCommand : class, TMessage
     where TEvent : class, TMessage
     where TRequest : class, TMessage
     where TResponse : class, TMessage
 {
     return(config.SerializedWith(
                new YamlMessageSerializer(),
                new YamlMessageDeserializerFactory(typeof(YamlMessageDeserializer <>))));
 }
Example #5
0
        public static ICanCreateEndpointAsClientOrServer <TMessage, TCommand, TEvent, TRequest, TResponse> SerializedAsNetJson <TMessage, TCommand, TEvent, TRequest, TResponse>(
            this ICanSpecifyEndpointSerializers <TMessage, TCommand, TEvent, TRequest, TResponse> config,
            bool gzipped = false)
            where TMessage : class
            where TCommand : class, TMessage
            where TEvent : class, TMessage
            where TRequest : class, TMessage
            where TResponse : class, TMessage
        {
            if (gzipped)
            {
                return(config.SerializedWith(
                           new GzippedNetJsonMessageSerializer(),
                           new NetJsonMessageDeserializerFactory(typeof(GzippedNetJsonMessageDeserializer <>))));
            }

            return(config.SerializedWith(
                       new NetJsonMessageSerializer(),
                       new NetJsonMessageDeserializerFactory(typeof(NetJsonMessageDeserializer <>))));
        }