Exemplo n.º 1
0
        public QXEnclosedListSerializer(string elementName, IQXSerializer childSerializer)
        {
            this.XmlElementName = elementName;

            this.RegisterXmlElementList(childSerializer, list => list, (list, child) => ((IList <object>)list).Add(child));
            this.IgnoreUnregisteredElements = false;
        }
Exemplo n.º 2
0
        public QXListSerializer(string elementName, IQXSerializer childSerializer)
            : base(elementName)
        {
            this.RegisterXmlElementList(childSerializer, list => list, (list, child) => ((IList <object>)list).Add(child));
            this.IgnoreUnregisteredElements = false;

            this.InstanceRetrievalMethod = () => new List <object>();
        }
Exemplo n.º 3
0
        protected void RegisterXmlElementList(IQXSerializer elementSerializer, QXElementListSelector <T> selector, QXContentIntegrator <T> integrator)
        {
            if (_ElementInfoCollection.Contains(elementSerializer.XmlElementName))
            {
                throw new Exception("The serializer for element \"" + elementSerializer.XmlElementName + "\" has already been registered to the parent serializer.");
            }

            _ElementInfoCollection.Add(new QXElementInfo <T>(elementSerializer)
            {
                ContentSelector = selector, ContentIntegrator = integrator, ElementType = QXElementType.List
            });
        }
Exemplo n.º 4
0
        protected void RegisterXmlEnclosedElementList(string enclosingElementName,
                                                      IQXSerializer elementSerializer, QXElementListSelector <T> selector, QXContentIntegrator <T> integrator)
        {
            object listSelector(T parent)
            {
                return(selector(parent));
            }

            void listIntegrator(T parent, object deserializedChild)
            {
                foreach (object item in (IEnumerable <object>)deserializedChild)
                {
                    integrator(parent, item);
                }
            }

            QXEnclosedListSerializer listSerializer = new QXEnclosedListSerializer(enclosingElementName, elementSerializer);

            this.RegisterXmlElement(listSerializer, listSelector, listIntegrator);
            this.SetElementProcessingMode(enclosingElementName, QXProcessingMode.IgnoreIfEmpty);
        }
Exemplo n.º 5
0
 public QXElementInfo(IQXSerializer elementSerializer)
 {
     this.ElementSerializer = elementSerializer;
 }
Exemplo n.º 6
0
 public new void UnregisterXmlElement(IQXSerializer elementSerializer) => base.UnregisterXmlElement(elementSerializer);
Exemplo n.º 7
0
 public new void RegisterXmlEnclosedElementList(string enclosingElementName,
                                                IQXSerializer elementSerializer, QXElementListSelector <T> selector, QXContentIntegrator <T> integrator)
 => base.RegisterXmlEnclosedElementList(enclosingElementName, elementSerializer, selector, integrator);
Exemplo n.º 8
0
 public new void RegisterXmlElementList(IQXSerializer elementSerializer, QXElementListSelector <T> selector, QXContentIntegrator <T> integrator)
 => base.RegisterXmlElementList(elementSerializer, selector, integrator);
Exemplo n.º 9
0
 protected void UnregisterXmlElement(IQXSerializer elementSerializer) => this.UnregisterXmlElement(elementSerializer.XmlElementName);