Example #1
0
        /// <summary>
        /// Gets the target proto role player.
        /// </summary>
        /// <param name="partition">Partition.</param>
        /// <returns>Target proto role player.</returns>
        public ModelProtoRolePlayer GetTargetRolePlayer(Partition partition)
        {
            DomainDataDirectory  domainDataDirectory = partition.Store.DomainDataDirectory;
            ModelProtoRolePlayer protoRolePlayer     = rolePlayers[1];
            DomainRoleInfo       domainRoleInfo      = domainDataDirectory.GetDomainRole(protoRolePlayer.DomainRoleId);

            if (domainRoleInfo.IsSource)
            {
                protoRolePlayer = rolePlayers[0];
            }
            return(protoRolePlayer);
        }
Example #2
0
        /// <summary>
        /// Creates a <see cref="PropertyDescriptor"/> for the <see cref="DomainPropertyInfo"/> or
        /// <see cref="DomainRoleInfo"/> with a <see cref="DomainObjectInfo.Id"/> equal to
        /// <paramref name="domainPropertyOrRoleId"/>.
        /// </summary>
        /// <param name="element">
        /// The instance of <see cref="ModelElement"/> containing the property for which a
        /// <see cref="PropertyDescriptor"/> should be created.
        /// </param>
        /// <param name="domainPropertyOrRoleId">
        /// The <see cref="DomainObjectInfo.Id"/> of the <see cref="DomainPropertyInfo"/> or
        /// <see cref="DomainRoleInfo"/> for which a <see cref="PropertyDescriptor"/> should
        /// be created.
        /// </param>
        /// <returns>
        /// A <see cref="PropertyDescriptor"/> for the <see cref="DomainPropertyInfo"/> or
        /// <see cref="DomainRoleInfo"/> with a <see cref="DomainObjectInfo.Id"/> equal to
        /// <paramref name="domainPropertyOrRoleId"/>.
        /// </returns>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="element"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="DomainDataNotFoundException">
        /// Neither a <see cref="DomainPropertyInfo"/> nor a <see cref="DomainRoleInfo"/>
        /// with a <see cref="DomainObjectInfo.Id"/> equal to
        /// <paramref name="domainPropertyOrRoleId"/> could be found.
        /// </exception>
        public static PropertyDescriptor CreatePropertyDescriptor(ModelElement element, Guid domainPropertyOrRoleId)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }
            DomainDataDirectory domainDataDirectory = element.Store.DomainDataDirectory;
            DomainPropertyInfo  domainPropertyInfo  = domainDataDirectory.FindDomainProperty(domainPropertyOrRoleId);

            if (domainPropertyInfo != null)
            {
                return(DomainTypeDescriptor.CreatePropertyDescriptor(element, domainPropertyInfo));
            }
            else
            {
                return(DomainTypeDescriptor.CreatePropertyDescriptor(element, domainDataDirectory.GetDomainRole(domainPropertyOrRoleId)));
            }
        }