Esempio n. 1
0
        /// <summary>
        /// Verifies if the given reference link belongs to the domain model (can be reached from the domain model element).
        /// </summary>
        /// <param name="modelLinkDCId">Model link domain class Id.</param>
        /// <param name="modelContextId">Model context Id.</param>
        /// <returns>True if the refrence link belongs to the domain model. False otherwise.</returns>
        public bool IsReferenceIncludedInModel(Guid modelContextId, Guid modelLinkDCId)
        {
            DomainRelationshipInfo info = this.Store.DomainDataDirectory.FindDomainRelationship(modelLinkDCId);

            if (IsIncludedInModel(modelContextId, DomainModelElement.GetSourceDomainRole(info).RolePlayer.Id))
            {
                return(true);
            }

            if (IsIncludedInModel(modelContextId, DomainModelElement.GetTargetDomainRole(info).RolePlayer.Id))
            {
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        private void ProcessInitializationInfo(Guid modelContextId, Guid domainClassId, List <Guid> processedClasses)
        {
            EmbeddingRelationshipOrderInfo info;

            this.embRelationshipOrderDictionary.TryGetValue(domainClassId, out info);

            if (info != null)
            {
                parentChildrenMapping[modelContextId].Add(domainClassId, new List <Guid>());
                parentChildrenMapping[modelContextId][domainClassId].AddRange(info.EmbeddingRelationships);

                parentChildrenCMMapping[modelContextId].Add(domainClassId, new List <Guid>());
                parentChildrenCMMapping[modelContextId][domainClassId].AddRange(info.EmbeddingRelationshipsTargetIncludedSubmodel);

                for (int i = 0; i < info.EmbeddingRelationships.Length; i++)
                {
                    DomainRelationshipInfo rInfo = this.Store.DomainDataDirectory.GetDomainRelationship(info.EmbeddingRelationships[i]);
                    DomainClassInfo        cInfo = DomainModelElement.GetTargetDomainRole(rInfo).RolePlayer;

                    if (!processedClasses.Contains(cInfo.Id))
                    {
                        processedClasses.Add(cInfo.Id);
                        ProcessInitializationInfo(modelContextId, cInfo.Id, processedClasses);
                    }

                    foreach (DomainClassInfo dInfo in cInfo.AllDescendants)
                    {
                        if (!processedClasses.Contains(dInfo.Id))
                        {
                            processedClasses.Add(dInfo.Id);
                            ProcessInitializationInfo(modelContextId, dInfo.Id, processedClasses);
                        }
                    }
                }
            }
        }