Example #1
0
 public UIGridBuilder(string name, string entity, string label = null)
 {
     Grid = new GridDefinition() { Name = name, Label = label ?? name, Entity = entity };
 }
Example #2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            JObject jObject = JObject.Load(reader);

            var typeId = Convert.ToInt32(jObject.Property("Type").Value.ToString());
            var type = (UITypes)typeId;

            object target = null;
            switch (type)
            {
                case UITypes.Form:
                    target = new FormDefinition();
                    break;
                case UITypes.Grid:
                    target = new GridDefinition();
                    break;
                case UITypes.View:
                    target = new ViewDefinition();
                    break;
                default:
                    throw new NotImplementedException("The UIDefinition type is not supported!");
            }

            serializer.Populate(jObject.CreateReader(), target);
            return target;
        }