Esempio n. 1
0
        /// <summary>
        /// See <see cref="System.Attribute.Equals"/>.
        /// </summary>
        public override bool Equals(object obj)
        {
            SupportedInterfaceAttribute other = obj as SupportedInterfaceAttribute;

            if (other == null)
            {
                return(false);
            }
            return(m_type != null ? m_type.Equals(other.m_type) : other.m_type == null);
        }
Esempio n. 2
0
        /// <summary>
        /// returns the repository id to use for type. In the repIdForType the string identifying the
        /// type is returned. The result and the repIdForType can be different (e.g. SupportedInterface)
        /// </summary>
        private string GetRepositoryIDFromType(Type type, out string repIdForType)
        {
            string result;

            object[] attr = type.GetCustomAttributes(ReflectionHelper.RepositoryIDAttributeType, false);
            if (attr != null && attr.Length > 0)
            {
                RepositoryIDAttribute repIDAttr = (RepositoryIDAttribute)attr[0];
                result = repIDAttr.Id;
            }
            else
            {
                result = IdlNaming.MapFullTypeNameToIdlRepId(type);
            }
            repIdForType = result;
            if (type.IsMarshalByRef)
            {
                attr = type.GetCustomAttributes(ReflectionHelper.SupportedInterfaceAttributeType, true);
                if (attr != null && attr.Length > 0)
                {
                    SupportedInterfaceAttribute repIDFrom = (SupportedInterfaceAttribute)attr[0];
                    Type fromType = repIDFrom.FromType;
                    if (fromType.Equals(type))
                    {
                        throw new INTERNAL(1701, CompletionStatus.Completed_MayBe);
                    }
                    string repIdForInterface;
                    result = GetRepositoryIDFromType(fromType, out repIdForInterface); // repository ID to use when serialising such a type
                }
            }
            if (IsValueTypeImplClass(type))
            {
                string repIdForValType;
                result = GetRepositoryIDFromType(type.BaseType, out repIdForValType); // repository ID to use when serialising such a type
            }
            return(result);
        }