static IMyFirstServiceClient() { SumAsyncMethod = new Method <byte[], byte[]>(MethodType.Unary, "IMyFirstService", "SumAsync", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); SumAsyncRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int>(default(int), default(int))); SumAsyncResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); SumAsync2Method = new Method <byte[], byte[]>(MethodType.Unary, "IMyFirstService", "SumAsync2", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); SumAsync2RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int>(default(int), default(int))); SumAsync2ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); StreamingOneMethod = new Method <byte[], byte[]>(MethodType.ClientStreaming, "IMyFirstService", "StreamingOne", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); StreamingOneRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); StreamingOneResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); StreamingTwoMethod = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IMyFirstService", "StreamingTwo", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); StreamingTwoRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int, int>(default(int), default(int), default(int))); StreamingTwoResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); StreamingTwo2Method = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IMyFirstService", "StreamingTwo2", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); StreamingTwo2RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int, int>(default(int), default(int), 9999)); StreamingTwo2ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); StreamingThreeMethod = new Method <byte[], byte[]>(MethodType.DuplexStreaming, "IMyFirstService", "StreamingThree", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); StreamingThreeRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); StreamingThreeResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); }
static IHeartbeatClient() { ConnectMethod = new Method <byte[], byte[]>(MethodType.DuplexStreaming, "IHeartbeat", "Connect", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ConnectRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.Nil> .Default); ConnectResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.Nil> .Default); TestSendMethod = new Method <byte[], byte[]>(MethodType.Unary, "IHeartbeat", "TestSend", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); TestSendRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); TestSendResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.Nil> .Default); }
static IArgumentPatternClient() { Unary1Method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "Unary1", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); Unary1RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int, string, global::SharedLibrary.MyEnum, global::SharedLibrary.MyStructResponse, ulong, global::SharedLibrary.MyRequest>(default(int), default(int), "unknown", SharedLibrary.MyEnum.Orange, default(global::SharedLibrary.MyStructResponse), 9, null)); Unary1ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyHugeResponse> .Default); Unary2Method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "Unary2", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); Unary2RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyRequest> .Default); Unary2ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyResponse> .Default); Unary3Method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "Unary3", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); Unary3RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, byte[]> .Default); Unary3ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyResponse> .Default); Unary5Method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "Unary5", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); Unary5RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyStructRequest> .Default); Unary5ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyStructResponse> .Default); ServerStreamingResult1Method = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IArgumentPattern", "ServerStreamingResult1", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ServerStreamingResult1RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int, string>(default(int), default(int), "unknown")); ServerStreamingResult1ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyResponse> .Default); ServerStreamingResult2Method = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IArgumentPattern", "ServerStreamingResult2", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ServerStreamingResult2RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyRequest> .Default); ServerStreamingResult2ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyResponse> .Default); ServerStreamingResult3Method = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IArgumentPattern", "ServerStreamingResult3", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ServerStreamingResult3RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, byte[]> .Default); ServerStreamingResult3ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyResponse> .Default); ServerStreamingResult4Method = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IArgumentPattern", "ServerStreamingResult4", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ServerStreamingResult4RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, byte[]> .Default); ServerStreamingResult4ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.Nil> .Default); ServerStreamingResult5Method = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IArgumentPattern", "ServerStreamingResult5", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ServerStreamingResult5RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyStructRequest> .Default); ServerStreamingResult5ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, global::SharedLibrary.MyStructResponse> .Default); UnaryS1Method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "UnaryS1", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); UnaryS1RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, global::System.DateTime, global::System.DateTimeOffset>(default(global::System.DateTime), default(global::System.DateTimeOffset))); UnaryS1ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, bool> .Default); UnaryS2Method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "UnaryS2", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); UnaryS2RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, int[]> .Default); UnaryS2ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, bool> .Default); UnaryS3Method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "UnaryS3", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); UnaryS3RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int[], string[], global::SharedLibrary.MyEnum[]>(default(int[]), default(string[]), default(global::SharedLibrary.MyEnum[]))); UnaryS3ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, bool> .Default); }
public UnaryResult <MyResponse> Unary1(int x, int y, string z = "unknown") { var tuple = new DynamicArgumentTuple <int, int>(x, y); var formatter = new DynamicArgumentTupleFormatter <DefaultResolver, int, int>(0, 0); var requestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(formatter); var method = new Method <byte[], byte[]>(MethodType.Unary, "IArgumentPattern", "Unary1", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); var request = requestMarshaller.Serializer(tuple); var callResult = invoker.AsyncUnaryCall(method, null, default(CallOptions), request); var responseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <DefaultResolver, MyResponse> .Default); return(new UnaryResult <MyResponse>(callResult, responseMarshaller)); }
static IStandardClient() { Unary1AsyncMethod = new Method <byte[], byte[]>(MethodType.Unary, "IStandard", "Unary1Async", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); Unary1AsyncRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int>(default(int), default(int))); Unary1AsyncResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); ClientStreaming1AsyncMethod = new Method <byte[], byte[]>(MethodType.ClientStreaming, "IStandard", "ClientStreaming1Async", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ClientStreaming1AsyncRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); ClientStreaming1AsyncResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, string> .Default); ServerStreamingAsyncMethod = new Method <byte[], byte[]>(MethodType.ServerStreaming, "IStandard", "ServerStreamingAsync", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); ServerStreamingAsyncRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(new DynamicArgumentTupleFormatter <ZeroFormatter.Formatters.DefaultResolver, int, int, int>(default(int), default(int), default(int))); ServerStreamingAsyncResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); DuplexStreamingAsyncMethod = new Method <byte[], byte[]>(MethodType.DuplexStreaming, "IStandard", "DuplexStreamingAsync", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); DuplexStreamingAsyncRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); DuplexStreamingAsyncResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); }
static PingClient() { Method = new Method <byte[], byte[]>(MethodType.DuplexStreaming, "IMagicOnionEmbeddedPing", "Ping", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); RequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, DateTime> .Default); ResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, double> .Default); }
static HeartbeatClient() { DuplexStreamingAsyncMethod = new Method <byte[], byte[]>(MethodType.DuplexStreaming, "IMagicOnionEmbeddedHeartbeat", "Connect", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); DuplexStreamingAsyncRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, bool> .Default); DuplexStreamingAsyncResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, bool> .Default); }
static ISendMetadataClient() { PangPongMethod = new Method <byte[], byte[]>(MethodType.Unary, "ISendMetadata", "PangPong", MagicOnionMarshallers.ByteArrayMarshaller, MagicOnionMarshallers.ByteArrayMarshaller); PangPongRequestMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(ZeroFormatter.Formatters.Formatter <ZeroFormatter.Formatters.DefaultResolver, byte[]> .Default); PangPongResponseMarshaller = MagicOnionMarshallers.CreateZeroFormatterMarshaller(Formatter <ZeroFormatter.Formatters.DefaultResolver, int> .Default); }