Example #1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.TokenType == JsonToken.Null)
            {
                return(null);
            }

            JObject jObject = JObject.Load(reader);
            Link    target  = default(Link);

            if (jObject != null)
            {
                target = Create(objectType);
                target.ExpressionCode     = jObject["ExpressionCode"].Value <string>();
                target.TargetViewInternal = jObject["TargetViewInternal"].Value <string>();
                if (jObject["TargetViewProperty"].HasValues)
                {
                    target.TargetViewProperty = jObject["TargetViewProperty"]["$ref"].Value <string>();
                }

                if (jObject["LinkParametersInternal"]["$values"].HasValues)
                {
                    foreach (var flchild in jObject["LinkParametersInternal"]["$values"])
                    {
                        LinkParameter f = new LinkParameter();
                        f.Expression            = flchild["Expression"].Value <string>();
                        f.ViewParameterInternal = flchild["ViewParameterInternal"].Value <string>();
                        target.AddLinkParameter(f);
                    }
                }
            }
            return(target);
        }
Example #2
0
 public void AddLinkParameter(LinkParameter lp)
 {
     lp.ParentSerializableEntity = this.parentEntity;
     linkParameters.Add(lp);
 }