Exemplo n.º 1
0
        /// <summary>
        /// If no relevant properties exist, an empty hashtable and list is returned.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="dataMappingInfos"></param>
        /// <param name="referObjs"></param>
        private static void GetTypeInfo(Type type, out Dictionary <string, PropertyDataBindingInfo> dataMappingInfos,
                                        out List <ReferencedTypeBindingInfo> referObjs,
                                        out Dictionary <string, DataMappingAttribute> propertyInfos)
        {
            PropertyInfo[] propertyList = type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            dataMappingInfos = new Dictionary <string, PropertyDataBindingInfo>();
            referObjs        = new List <ReferencedTypeBindingInfo>();
            //propertyInfos = new Dictionary<string, DataMappingAttribute>(new CaseInsensitiveStringEqualityComparer());

            propertyInfos = new Dictionary <string, DataMappingAttribute>(new CaseInsensitiveStringEqualityComparer());

            foreach (PropertyInfo propertyInfo in propertyList)
            {
                object[] attributes = propertyInfo.GetCustomAttributes(false);
                foreach (object attribute in attributes)
                {
                    // properties binding to a data column
                    if (attribute is DataMappingAttribute)
                    {
                        DataMappingAttribute obj = attribute as DataMappingAttribute;
                        dataMappingInfos[obj.ColumnName.ToUpper()] = new PropertyDataBindingInfo(obj, propertyInfo);

                        propertyInfos.Add(propertyInfo.Name, obj);
                        continue;
                    }

                    // properties that are referenced objects
                    if (attribute is ReferencedEntityAttribute)
                    {
                        ReferencedEntityAttribute obj = attribute as ReferencedEntityAttribute;
                        referObjs.Add(new ReferencedTypeBindingInfo(obj, propertyInfo));
                    }
                }
            }
        }
Exemplo n.º 2
0
 public ReferencedTypeBindingInfo(ReferencedEntityAttribute attri, PropertyInfo propertyInfo)
 {
     m_ReferencedEntityAttribute = attri;
     m_PropertyInfo = propertyInfo;
 }