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);
            }
        }
Exemple #2
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);
        }