示例#1
0
        private static MapperCommand GetCommand(MapperProvider provider, CommandItem item, params object[] source)
        {
            if (provider == null)
            {
                provider = MapperProvider.DefaultProvider;
            }
            List <ParameterSource> parameterSources = MapperCommand.ConvertParameterSource(provider, source);
            MapperCommand          mapperCommand    = new MapperCommand(provider)
            {
                commandId       = item.Id,
                parameterSource = parameterSources,
                Type            = item.Type,
                Text            = item.GetParameterMatchText(parameterSources),
                Result          = item.ResultType,
                Timeout         = item.Timeout
            };

            mapperCommand.BuildCommand();
            return(mapperCommand);
        }
示例#2
0
        public void ApplyParameter()
        {
            CommandItem commandItem = new CommandItem()
            {
                Text = this.Text
            };

            commandItem.Parse();
            if (this.parameterSource == null)
            {
                this.parameterSource = new List <ParameterSource>();
                this.parameterSource.AddRange(this.provider.Parameter);
                foreach (MapperParameterItem value in this.Parameter.Values)
                {
                    this.parameterSource.Add(new ParameterSource()
                    {
                        Name  = value.ParameterName,
                        Value = value.Value
                    });
                }
            }
            this.Text = commandItem.GetParameterMatchText(this.parameterSource);
        }