示例#1
0
        /// <summary>
        /// Initialise l'instance depuis des données XML
        /// </summary>
        /// <param name="element">Élément contenant les information sur l'objet</param>
        /// <param name="aggregationCallback">Permet d'appliquer des modifications aux entités importées par aggrégation</param>
        /// <remarks>Seuls les éléments existants dans le noeud Xml son importés dans l'objet</remarks>
        public void FromXml(XmlElement element, EntityCallback aggregationCallback)
        {
            foreach (XmlElement m in element.ChildNodes)
            {
                string property_value = m.InnerText.Trim();
                // charge les paramètres
                switch (m.Name)
                {
                //
                // Fields
                //

                // Assigne le membre Name
                case "Name":
                {
                    this.name = property_value;
                }
                break;

                // Assigne le membre Version
                case "Version":
                {
                    this.version = property_value;
                }
                break;

                //
                // Aggregations
                //

                // Assigne la collection ObjectContent
                case "ObjectContent":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("ObjectContent" == c.Name)
                        {
                            ObjectContent value = new ObjectContent();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddObjectContent(value);
                        }
                    }
                }
                break;

                // Assigne la collection SearchParams
                case "SearchParams":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("SearchParams" == c.Name)
                        {
                            SearchParams value = new SearchParams();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddSearchParams(value);
                        }
                    }
                }
                break;

                // Assigne la collection ObjectSyntax
                case "ObjectSyntax":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("ObjectSyntax" == c.Name)
                        {
                            ObjectSyntax value = new ObjectSyntax();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddObjectSyntax(value);
                        }
                    }
                }
                break;

                // Assigne la collection ParamSyntax
                case "ParamSyntax":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("ParamSyntax" == c.Name)
                        {
                            ParamSyntax value = new ParamSyntax();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddParamSyntax(value);
                        }
                    }
                }
                break;

                // Assigne la collection DatabaseSource
                case "DatabaseSource":
                {
                    foreach (XmlElement c in m.ChildNodes)
                    {
                        if ("DatabaseSource" == c.Name)
                        {
                            DatabaseSource value = new DatabaseSource();
                            value.FromXml(c, aggregationCallback);
                            if (aggregationCallback != null)
                            {
                                aggregationCallback(value);
                            }
                            this.AddDatabaseSource(value);
                        }
                    }
                }
                break;
                }
            }
        }
示例#2
0
 public void RemoveSearchParams(SearchParams obj)
 {
     obj.Project = null;
     SearchParams.Remove(obj);
 }
示例#3
0
        /// <summary>
        /// Initialise l'instance depuis les données d'un flux binaire
        /// </summary>
        /// <param name="reader">Flux binaire</param>
        /// <param name="aggregationCallback">Permet d'appliquer des modifications aux entités importées par aggrégation</param>
        /// <remarks>Seuls les éléments existants dans le noeud Xml son importés dans l'objet</remarks>
        public void ReadBinary(BinaryReader reader, EntityCallback aggregationCallback)
        {
            // Properties
            Name    = reader.ReadString();
            Version = reader.ReadString();

            // ObjectContent
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.ObjectContent = new Collection <ObjectContent>();
                    for (int i = 0; i < size; i++)
                    {
                        ObjectContent o = new ObjectContent();
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddObjectContent(o);
                    }
                }
                else
                {
                    this.ObjectContent = new Collection <ObjectContent>();
                }
            }
            // SearchParams
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.SearchParams = new Collection <SearchParams>();
                    for (int i = 0; i < size; i++)
                    {
                        SearchParams o = new SearchParams();
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddSearchParams(o);
                    }
                }
                else
                {
                    this.SearchParams = new Collection <SearchParams>();
                }
            }
            // ObjectSyntax
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.ObjectSyntax = new Collection <ObjectSyntax>();
                    for (int i = 0; i < size; i++)
                    {
                        ObjectSyntax o = new ObjectSyntax();
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddObjectSyntax(o);
                    }
                }
                else
                {
                    this.ObjectSyntax = new Collection <ObjectSyntax>();
                }
            }
            // ParamSyntax
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.ParamSyntax = new Collection <ParamSyntax>();
                    for (int i = 0; i < size; i++)
                    {
                        ParamSyntax o = new ParamSyntax();
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddParamSyntax(o);
                    }
                }
                else
                {
                    this.ParamSyntax = new Collection <ParamSyntax>();
                }
            }
            // DatabaseSource
            {
                int size = reader.ReadInt32();
                if (size > 0)
                {
                    this.DatabaseSource = new Collection <DatabaseSource>();
                    for (int i = 0; i < size; i++)
                    {
                        DatabaseSource o = new DatabaseSource();
                        o.ReadBinary(reader, aggregationCallback);
                        if (aggregationCallback != null)
                        {
                            aggregationCallback(o);
                        }
                        this.AddDatabaseSource(o);
                    }
                }
                else
                {
                    this.DatabaseSource = new Collection <DatabaseSource>();
                }
            }
        }
示例#4
0
 public void AddSearchParams(SearchParams obj)
 {
     obj.Project = this;
     SearchParams.Add(obj);
 }