예제 #1
0
 public GenericTypeInfo GatherTypeInfo(AttributeType propertyAttributes = AttributeType.None)
 {
     DetermineObjectType();
     if (IsPoco)
     {
         Properties = GenericType.GetProperties().ToList();
         for (int i = 0; i < Properties.Count; i++)
         {
             var propInfo = Properties[i];
             ThrowIfPropIsIndexer(propInfo);
             PropertyNames.Add(propInfo.Name);
             PropertiesByName.Add(propInfo.Name, propInfo);
             UnderlyingPropType.Add(propInfo, TryGetUnderlyingType(propInfo));
             TryExtractAttribute(propertyAttributes, propInfo);
             RetrieveAdditionalTypeInfo(propInfo, i);
         }
     }
     return(this);
 }
예제 #2
0
 /// <summary>
 /// Reads the type information from <see cref="Typ"/>.
 /// </summary>
 /// <returns>The TypeInfo object containing information about the Typ.</returns>
 public TypeInfo GatherTypeInfo()
 {
     IsArray = Typ.IsArray;
     if (typeof(IDynamicMetaObjectProvider).IsAssignableFrom(Typ))
     {
         IsDynamic = true;
     }
     if (!IsArray && !IsDynamic)
     {
         Properties     = Typ.GetProperties();
         PropertyLength = Properties.Length;
         int index = 0;
         foreach (var propInfo in Properties)
         {
             PropertyIndex.Add(propInfo.Name, index);
             PropertiesByName.Add(propInfo.Name, propInfo);
             RetrieveAdditionalTypeInfo(propInfo, index);
             index++;
         }
     }
     return(this);
 }