Example #1
0
        /// <summary>
        /// Construit les objets de domaine.
        /// </summary>
        /// <param name="domainsDefinition">Le noeud XML de définition des domaines.</param>
        /// <param name="elementsExtension">Le noeud XML contenant les extentions d'éléments.</param>
        /// <param name="modelFile">Fichier modèle.</param>
        private void BuildModelDomains(XmlNode domainsDefinition, XmlNode elementsExtension, string modelFile)
        {
            foreach (XmlNode domainNode in domainsDefinition.ChildNodes)
            {
                string  id = domainNode.Attributes[PropertyId].Value;
                XmlNode domaineExtensionNode = elementsExtension.SelectSingleNode(string.Format(NodeElementByIdRef, id), _currentNsManager);

                string persistentDataType = domaineExtensionNode.SelectSingleNode(NodeProperties, _currentNsManager).Attributes[PropertyAlias].Value;
                int?   persistentLength   = null;
                if (_regexPersistentLength.IsMatch(persistentDataType))
                {
                    persistentLength = int.Parse(_regexPersistentLength.Replace(persistentDataType, "$1"));
                }

                int?persistentPrecision = null;
                if (_regexPersistentPrecision.IsMatch(persistentDataType))
                {
                    persistentPrecision = int.Parse(_regexPersistentPrecision.Replace(persistentDataType, "$1"));
                }

                ModelDomain domaine = new ModelDomain()
                {
                    Name                = domainNode.Attributes[PropertyName].Value,
                    ModelFile           = modelFile,
                    Code                = domainNode.Attributes[PropertyName].Value,
                    DataType            = domaineExtensionNode.SelectSingleNode(NodeProperties, _currentNsManager).Attributes[PropertyStereotype].Value,
                    PersistentDataType  = persistentDataType,
                    PersistentLength    = persistentLength,
                    PersistentPrecision = persistentPrecision,
                    Model               = _currentModelRoot
                };
                _currentModelRoot.AddDomain(id, domaine);
                CheckDomain(domaine);
            }
        }