Exemplo n.º 1
0
        private void DeserializeContainer(Container container, JObject json)
        {
            DeserializeComponent(container, json);

            foreach (var componentProp in json.Properties().Where(x =>
                !x.Name.StartsWith("$") && x.HasValues && x.Value.Type == JTokenType.Object))
            {
                var componentJson = (JObject)componentProp.Value;
                var componentSchemaId = GetSchema(componentJson);

                if (componentJson.Property("$items") != null)
                {
                    DeserializeCollection(container.CreateCollection(componentProp.Name, componentSchemaId), componentJson);
                }
                else
                {
                    DeserializeElement(container.CreateElement(componentProp.Name, componentSchemaId), componentJson);
                }
            }
        }