コード例 #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="link">Element link.</param>
        public ModelProtoLink(ElementLink link)
            : base(link)
        {
            if (link == null)
            {
                throw new System.ArgumentNullException("link");
            }

            IList <Microsoft.VisualStudio.Modeling.DomainRoleInfo> ilist = link.GetDomainRelationship().DomainRoles;

            rolePlayers = new System.Collections.Generic.List <ModelProtoRolePlayer>(2);
            for (int i = 0; i < 2; i++)
            {
                Microsoft.VisualStudio.Modeling.DomainRoleInfo domainRoleInfo = ilist[i];
                Microsoft.VisualStudio.Modeling.ModelElement   modelElement   = domainRoleInfo.GetRolePlayer(link);
                System.Guid guid = modelElement != null ? modelElement.Id : System.Guid.Empty;

                string name = "";
                if (modelElement is IDomainModelOwnable)
                {
                    if ((modelElement as IDomainModelOwnable).DomainElementHasName)
                    {
                        name = (modelElement as IDomainModelOwnable).DomainElementName;
                    }
                }

                rolePlayers.Add(new ModelProtoRolePlayer(domainRoleInfo.Id, guid, name));
            }

            this.isTargetIncludedSubmodel = false;
            this.domainFilePath           = "";
        }
コード例 #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="link">Element link.</param>
        public ModelProtoLink(ElementLink link)
            : base(link)
        {
            if (link == null)
            {
                throw new System.ArgumentNullException("link");
            }

            IList <Microsoft.VisualStudio.Modeling.DomainRoleInfo> ilist = link.GetDomainRelationship().DomainRoles;

            rolePlayers = new System.Collections.Generic.List <ModelProtoRolePlayer>(2);
            for (int i = 0; i < 2; i++)
            {
                Microsoft.VisualStudio.Modeling.DomainRoleInfo domainRoleInfo = ilist[i];
                Microsoft.VisualStudio.Modeling.ModelElement   modelElement   = domainRoleInfo.GetRolePlayer(link);
                System.Guid guid = modelElement != null ? modelElement.Id : System.Guid.Empty;


                if (modelElement is DomainClass)
                {
                    rolePlayers.Add(new ModelProtoRolePlayer(domainRoleInfo.Id, guid, (modelElement as DomainClass).Name));
                }
                else
                {
                    rolePlayers.Add(new ModelProtoRolePlayer(domainRoleInfo.Id, guid, ""));
                }
            }
        }