示例#1
0
 public void Update()
 {
     ClearCases();
     if (_curContext == null)
     {
         if (_started)
         {
             _out.Write(Content.root_message);
         }
         else
         {
             var country = _services.GetService <CountryController>().PlayerCountry;
             if (country != null)
             {
                 var countryName = country.Name;
                 var raceName    = Content.ResourceManager.GetString("race_" + country.Kind.Id);;
                 _out.WriteFormat(Content.hello_message, countryName, raceName);
                 _started = true;
             }
         }
         OnStart.Invoke();
     }
     else
     {
         _curContext.Update();
     }
 }
        protected static void ExcuteSubUpdate(UpdateContext context, UpdateConfig updateConfig, object parent)
        {
            var config = updateConfig.Config;
            if (config == null)
            {
                return;
            }

            var subConfigs = config[RelatedUpdates];
            if (subConfigs == null)
            {
                return;
            }

            var relatedConfigs = subConfigs.ToObject<IEnumerable<UpdateConfig>>();
            if (relatedConfigs.Any() == false)
            {
                return;
            }

            foreach (var relatedConfig in relatedConfigs)
            {
                relatedConfig.InTran = true;
                IUpdateHandler queryHandler = UpdateHandlerFactory.GetUpdateHandler(relatedConfig.QueryType);
                var subContext = new UpdateContext(context)
                {
                    ComplexData = parent,
                    Configs = new UpdateConfig[] { relatedConfig }
                };

                queryHandler.Update(subContext);
            }
        }
        public static object Update(UpdateHandlerConfig handlerConfig, object complexData, IDictionary <string, object> queryParams = null)
        {
            IUpdateHandler updateHandler = UpdateHandlerFactory.GetUpdateHandler(handlerConfig.QueryType);
            var            context       = new UpdateContext
            {
                HandlerConfig = handlerConfig,
                Configs       = handlerConfig.Configs,
                Params        = queryParams,
                ComplexData   = complexData
            };

            ParamConvertUtil.DoConvert(context);
            var result = updateHandler.Update(context);

            if (context.Conns != null && context.Conns.Any())
            {
                context.Submit();
            }

            return(result);
        }
示例#4
0
        protected override object DoUpdate(UpdateContext context)
        {
            var handlerConfig = context.HandlerConfig;
            var configs       = context.Configs;
            var updateParam   = context.Params;
            var complexData   = context.ComplexData;
            IDictionary <string, object> dictDatas = SetContentData(context, complexData);

            foreach (var config in configs)
            {
                IUpdateHandler queryHandler = UpdateHandlerFactory.GetUpdateHandler(config.QueryType);
                context.Configs = new UpdateConfig[] { config };
                var data = queryHandler.Update(context);
                if (string.IsNullOrEmpty(config.Filed))
                {
                    continue;
                }

                //主要是争对查询结果储存,可能后面更改会用到
                dictDatas.Add(config.Filed, data);
            }

            return(true);
        }
示例#5
0
 public TSaveResponse Update(IUnitOfWork uow, TSaveRequest request)
 {
     return(handler.Update(uow, request));
 }