protected override IInstruction BuildInstruction(DuplexMessage commandMessage) { var instrSet = new InstructionSet(this); using (var scope = ObjectHost.Host.BeginLifetimeScope()) { instrSet.AddInstruction(scope.Resolve<CheckInQueryInstruction>( new NamedParameter("command", this), new NamedParameter("parameter", commandMessage.GetContent<object>()))); instrSet.AddInstruction(scope.Resolve<CheckInReplyInstruction>( new NamedParameter("parameter", commandMessage.GetContent<object>()))); } return instrSet; }
protected override IInstruction BuildInstruction(DuplexMessage commandMessage) { var instrSet = new InstructionSet(this); using (var scope = ObjectHost.Host.BeginLifetimeScope()) { instrSet.AddInstruction(scope.Resolve <CheckInQueryInstruction>( new NamedParameter("command", this), new NamedParameter("parameter", commandMessage.GetContent <object>()))); instrSet.AddInstruction(scope.Resolve <CheckInReplyInstruction>( new NamedParameter("parameter", commandMessage.GetContent <object>()))); } return(instrSet); }
bool UpdateRegisterInfo(School school, DuplexMessage commandMessage) { var registerOk = false; var registerInfo = commandMessage.GetContent <RegisterInfo>(); if (registerInfo != null) { school.ClientPubKey = registerInfo.ClientPubKey; school.UniqueToken = registerInfo.ClientMacAddr; metaRepository.AddOrUpdateSchool(school, (updateOk) => { DuplexMessage resultMessage; if (updateOk) { resultMessage = DuplexMessage.CreateCallbackMessage(commandMessage); } else { resultMessage = DuplexMessage.CreateCallbackMessage(commandMessage, ErrorCode.RegisterFailed); } Return(resultMessage); }); registerOk = true; } return(registerOk); }
protected override DuplexMessage DoExecute(DuplexMessage commandMessage) { Log.Error(ErrorCode.BadProtocalVersion, new Exception("error")); var content = commandMessage.GetContent <Customer>(); return(DuplexMessage.CreateCallbackMessage(commandMessage, content)); }
bool UpdateRegisterInfo(School school, DuplexMessage commandMessage) { var registerOk = false; var registerInfo = commandMessage.GetContent<RegisterInfo>(); if (registerInfo != null) { school.ClientPubKey = registerInfo.ClientPubKey; school.UniqueToken = registerInfo.ClientMacAddr; metaRepository.AddOrUpdateSchool(school, (updateOk) => { DuplexMessage resultMessage; if (updateOk) resultMessage = DuplexMessage.CreateCallbackMessage(commandMessage); else resultMessage = DuplexMessage.CreateCallbackMessage(commandMessage, ErrorCode.RegisterFailed); Return(resultMessage); }); registerOk = true; } return registerOk; }
protected override DuplexMessage DoExecute(DuplexMessage commandMessage) { Log.Error(ErrorCode.BadProtocalVersion, new Exception("error")); var content = commandMessage.GetContent<Customer>(); return DuplexMessage.CreateCallbackMessage(commandMessage, content); }