Пример #1
0
 public void Initialize(PluginInitializationContext context)
 {
     context.AddInvocationInterceptor((prx, request, next) =>
     {
         request.AddBinaryContextEntry(100, Environment.UserName, (ostr, value) => ostr.WriteString(value));
         return(next(prx, request));
     });
 }
Пример #2
0
 public void Initialize(PluginInitializationContext context)
 {
     context.AddInvocationInterceptor(
         async(target, request, next) =>
     {
         if (request.Protocol == Protocol.Ice2)
         {
             request.ContextOverride["InvocationPlugin"] = "1";
         }
         IncomingResponseFrame response = await next(target, request);
         if (response.Protocol == Protocol.Ice2 && response.ResultType == ResultType.Success)
         {
             TestHelper.Assert(
                 response.BinaryContext.TryGetValue(100, out ReadOnlyMemory <byte> value) &&
                 value.Read(istr => istr.ReadInt()) == 100);
         }
         return(response);
     });
 }