示例#1
0
        public ReflectedType(Type type)
        {
            UnderlyingType = type;
            TypeName       = type.GetFriendlyName();
            FullTypeName   = type.FullName;
            var interfaceType = Reflector.GetInterface(type);

            if (interfaceType != null)
            {
                InterfaceType     = interfaceType;
                InterfaceTypeName = interfaceType.FullName;
            }
            IsArray      = type.IsArray;
            IsList       = Reflector.IsList(type);
            IsDictionary = Reflector.IsDictionary(type);
            IsSimpleList = Reflector.IsSimpleList(type);
            IsDataEntity = Reflector.IsDataEntity(type) || (!Reflector.IsSimpleType(type) && !IsArray && !IsList && !IsDictionary);
            Type elementType;

            IsDataEntityList = Reflector.IsDataEntityList(type, out elementType);
            ElementType      = elementType;
            if (IsDataEntityList)
            {
                IsPolymorphicList = elementType != null && elementType.IsAbstract && (!elementType.IsInterface || !Reflector.IsDataEntity(elementType));
                IsListInterface   = type.GetGenericTypeDefinition() == typeof(IList <>);
            }
            IsSimpleType      = Reflector.IsSimpleType(type);
            IsNullableType    = Reflector.IsNullableType(type);
            IsMarkerInterface = Reflector.IsMarkerInterface(type);
            HashCode          = type.GetHashCode();
            IsGenericType     = type.IsGenericType;
            IsInterface       = type.IsInterface;
            IsAnonymous       = Reflector.IsAnonymousType(type);
            IsEmitted         = Reflector.IsEmitted(type);
        }