private void HookLog(SessionContext Context, JsonLogAspectWrapper law) { law.ClientCommandIn += (CommandName, Parameters) => { Interlocked.Add(ref RequestCountValue, 1); if (EnableLogNormalIn) { RaiseSessionLog(new SessionLogEntry { Token = Context.SessionTokenString, RemoteEndPoint = Context.RemoteEndPoint, Time = DateTime.UtcNow, Type = "In", Name = CommandName, Message = Parameters }); } }; law.ClientCommandOut += (CommandName, Parameters) => { Interlocked.Add(ref ReplyCountValue, 1); if (EnableLogNormalOut) { RaiseSessionLog(new SessionLogEntry { Token = Context.SessionTokenString, RemoteEndPoint = Context.RemoteEndPoint, Time = DateTime.UtcNow, Type = "Out", Name = CommandName, Message = Parameters }); } }; law.ServerCommand += (CommandName, Parameters) => { Interlocked.Add(ref EventCountValue, 1); if (EnableLogNormalOut) { RaiseSessionLog(new SessionLogEntry { Token = Context.SessionTokenString, RemoteEndPoint = Context.RemoteEndPoint, Time = DateTime.UtcNow, Type = "Out", Name = CommandName, Message = Parameters }); } }; }
public KeyValuePair <IServerImplementation, IJsonSerializationServerAdapter> CreateServerImplementationWithJsonAdapter(TaskFactory Factory, ISessionContext SessionContext) { var sc = (SessionContext)(SessionContext); if (sc == null) { throw new InvalidOperationException(); } var si = CreateServerImplementation(sc); var law = new JsonLogAspectWrapper(si); HookLog(sc, law); var a = new JsonSerializationServerAdapter(Factory, law); return(new KeyValuePair <IServerImplementation, IJsonSerializationServerAdapter>(si, a)); }