Exemple #1
0
        public IModel SetRaw(object value, string key = null)
        {
            if (value == null)
            {
                value = JRaw.CreateNull();
            }
            else
            {
                if (!(value is JToken))
                {
                    throw new ArgumentException("SetRaw必须用JToken作为value参数");
                }
            }
            if (key == null)
            {
                this.Internals  = value as JObject ?? new JObject();
                this.HasChanges = true;
                return(this);
            }
            var token = value as JToken;

            this.Internals[key] = token;
            this.HasChanges     = true;
            return(this);
        }