public JToken Serialize(
     IModelMember dataSource,
     ISerializerProvider provider,
     IElementSerializer elementSerializer)
 {
     var attrDataSource = dataSource as IModelAttributeMember;
     return new JProperty(attrDataSource.Name, attrDataSource.Value);
 }
Exemplo n.º 2
0
        public void Accept(IElementSerializer serializer)
        {
            bool isNotIgnored = serializer.PreSerializeElement(this);

            if (isNotIgnored)
            {
                serializer.Serialize(this);
            }
        }
Exemplo n.º 3
0
        public void Accept(IElementSerializer serializer)
        {
            bool isNotIgnored = serializer.PreSerializeElement(this);

            if (isNotIgnored)
            {
                serializer.Serialize(this);
            }
        }
        public JToken Serialize(
            IModelMember dataSource, 
            ISerializerProvider provider, 
            IElementSerializer elementSerializer)
        {
            var elDataSource = dataSource as IModelElementMember;

            var res = new JProperty(elDataSource.Name);
            res.Value = elementSerializer.Serialize(elDataSource.Element, provider);
            return res;
        }
Exemplo n.º 5
0
 public ElementWrapperPartDriver(
     IElementManager elementManager,
     IElementDisplay elementDisplay,
     IElementSerializer serializer,
     ICultureAccessor cultureAccessor,
     IWorkContextAccessor wca)
 {
     _elementManager  = elementManager;
     _elementDisplay  = elementDisplay;
     _serializer      = serializer;
     _cultureAccessor = cultureAccessor;
     _wca             = wca;
 }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var current = destination as IModelElementMember;

            var jObjDataSource = dataSource as JObject;
            if (jObjDataSource == null) return;

            elementSerializer.Deserialize(jObjDataSource, current.Element, provider);
        }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var jValue = dataSource as JValue;
            if (jValue == null) return;

            var current = destination as IModelAttributeMember;

            current.Value = jValue.ToObject(current.Type);
        }
Exemplo n.º 8
0
        public void Accept(IElementSerializer serializer)
        {
            bool isNotIgnored = serializer.PreSerializeElement(this);

            if (isNotIgnored)
            {
                foreach (var element in ChildElements)
                {
                    element.Accept(serializer);
                }

                serializer.Serialize(this);
            }
        }
Exemplo n.º 9
0
        public void Accept(IElementSerializer serializer)
        {
            bool isNotIgnored = serializer.PreSerializeElement(this);

            if (isNotIgnored)
            {
                foreach (var element in ChildElements)
                {
                    element.Accept(serializer);
                }

                serializer.Serialize(this);
            }
        }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var current = destination as IModelCollectionMember;

            var jArrayDataSource = dataSource as JArray;
            if (jArrayDataSource == null) return;

            foreach (var childJObject in jArrayDataSource.Children().OfType<JObject>())
            {
                var newEl = current.Elements.Create();
                elementSerializer.Deserialize(childJObject, newEl, provider);
            }
        }
        public JToken Serialize(
            IModelMember dataSource, 
            ISerializerProvider provider, 
            IElementSerializer elementSerializer)
        {
            var colDataSource = dataSource as IModelCollectionMember;

            var arr = new JArray();
            var res = new JProperty(colDataSource.Name, arr);
            foreach (var element in colDataSource.Elements)
            {
                var newEl = elementSerializer.Serialize(element, provider);
                arr.Add(newEl);
            }

            return res;
        }
        public JToken Serialize(
            IModelMember dataSource, 
            ISerializerProvider provider, 
            IElementSerializer elementSerializer)
        {
            var dictDataSource = dataSource as IModelDictionaryMember;

            var dict = new JObject();
            var res = new JProperty(dictDataSource.Name, dict);
            foreach (var key in dictDataSource.Elements.Keys)
            {
                var newEl = new JProperty(key);
                newEl.Value = elementSerializer.Serialize(dictDataSource.Elements[key], provider);
                dict.Add(newEl);
            }

            return res;
        }
        public void Deserialize(
            JToken dataSource,
            IModelMember destination,
            ISerializerProvider provider,
            IElementSerializer elementSerializer)
        {
            var current = destination as IModelDictionaryMember;

            var jObjDataSource = dataSource as JObject;
            if (jObjDataSource == null) return;

            foreach (var childJProp in jObjDataSource.Children().OfType<JProperty>())
            {
                var childJObj = childJProp.Value as JObject;
                if (childJObj == null) return;

                var newEl = current.Elements.Create(childJProp.Name);
                elementSerializer.Deserialize(childJObj, newEl, provider);
            }
        }
Exemplo n.º 14
0
 public LayoutSerializer(IElementSerializer elementSerializer)
 {
     _elementSerializer = elementSerializer;
 }
 public LayoutSerializer(IElementSerializer elementSerializer) {
     _elementSerializer = elementSerializer;
 }
Exemplo n.º 16
0
 public static void AddSerializer <T>(IElementSerializer <T> serializer)
 {
     m_customSerializers[typeof(T)] = serializer;
 }