Exemple #1
0
        public virtual bool FillWithAttributes(IJSONDocument source, IJSONDocument target)
        {
            if (source != null && target != null)
            {
                IJsonValue wrapedValue;
                if (_fieldName.ToString().Equals("_key"))
                {
                    if (source.Contains("!_key"))
                    {
                        target.Key = source.GetString("!_key");
                    }
                    else
                    {
                        target.Add("!_key", source.Key);
                    }
                    return(true);
                }

                if (_fieldName.Evaluate(out wrapedValue, source))
                {
                    IAttributeChain attributor = Attributor.Create(Attributor.Delimit(_fieldName.InString, new[] { '$' }));
                    Attributor.TryUpdate(target, wrapedValue.Value, attributor, true);
                    return(true);
                }
            }
            return(false);
        }