Esempio n. 1
0
        /// <summary>determines the non-default types, this type depends on</summary>
        private void DetermineInheritanceDependencies()
        {
            m_dependenciesInheritance = new ArrayList();

            // for the following types the base classes must be mapped
            if (m_forType.IsClass &&
                (ClsToIdlMapper.IsMappedToConcreteValueType(m_forType) ||
                 ClsToIdlMapper.IsMappedToAbstractValueType(m_forType) ||
                 ClsToIdlMapper.IsMappedToConcreteInterface(m_forType) ||
                 ClsToIdlMapper.IsMappedToAbstractInterface(m_forType) ||
                 ClsToIdlMapper.IsMappedToLocalInterface(m_forType)))
            {
                // boxed value types are excluded here, because they do not have inheritance dependencies
                Type baseType = m_forType.BaseType;
                if (!((baseType.Equals(typeof(System.Object))) || (baseType.Equals(typeof(System.ValueType))) ||
                      (baseType.Equals(typeof(System.ComponentModel.MarshalByValueComponent))) ||
                      (baseType.Equals(typeof(System.MarshalByRefObject)))))
                {
                    AddToDepList(m_dependenciesInheritance,
                                 CreateMapTypeInfo(baseType, AttributeExtCollection.EmptyCollection),
                                 true);
                }
            }

            // for the following types, implemented interfaces must be considered
            if (ClsToIdlMapper.IsMappedToAbstractValueType(m_forType) ||
                ClsToIdlMapper.IsMappedToConcreteValueType(m_forType) ||
                ClsToIdlMapper.IsMappedToConcreteInterface(m_forType) ||
                ClsToIdlMapper.IsMappedToAbstractInterface(m_forType) ||
                ClsToIdlMapper.IsMappedToLocalInterface(m_forType))
            {
                Type[] implementedIF = m_forType.GetInterfaces();
                for (int i = 0; i < implementedIF.Length; i++)
                {
                    // don't map to IDL, if not legal to inherit from
                    if (ClsToIdlMapper.MapInheritanceFromInterfaceToIdl(implementedIF[i], m_forType))
                    {
                        AddToDepList(m_dependenciesInheritance,
                                     CreateMapTypeInfo(implementedIF[i], AttributeExtCollection.EmptyCollection),
                                     true);
                    }
                }
            }
        }