/// <summary> /// Gets the type discription. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public static TypeDescription GetTypeDiscription(Type type) { TypeDescription description = s_typeInfoDict[type.FullName] as TypeDescription; if (description == null) { PropertyInfo[] properties = type.GetProperties(s_flag); int length = properties.Length; Dictionary <string, DbMapInfo> dictionary = new Dictionary <string, DbMapInfo>(length, StringComparer.OrdinalIgnoreCase); foreach (PropertyInfo info in properties) { DbMapInfo info2 = null; DataColumnAttribute myAttribute = info.GetMyAttribute <DataColumnAttribute>(); IgnoreColumnAttribute attrIgnore = info.GetMyAttribute <IgnoreColumnAttribute>(); if (myAttribute != null) { info2 = new DbMapInfo(string.IsNullOrEmpty(myAttribute.Alias) ? info.Name : myAttribute.Alias, info.Name, myAttribute, attrIgnore, info); } else { info2 = new DbMapInfo(info.Name, info.Name, null, attrIgnore, info); } dictionary[info2.DbName] = info2; } description = new TypeDescription { MemberDict = dictionary }; s_typeInfoDict[type.FullName] = description; } return(description); }
/// <summary> /// Initializes a new instance of the <see cref="DbMapInfo"/> class. /// </summary> /// <param name="dbName">Name of the database.</param> /// <param name="netName">Name of the net.</param> /// <param name="attrColumn">The attribute column.</param> /// <param name="attrIgnore">The attribute ignore.</param> /// <param name="prop">The property.</param> public DbMapInfo(string dbName, string netName, DataColumnAttribute attrColumn, IgnoreColumnAttribute attrIgnore, PropertyInfo prop) { this.DbName = dbName; this.NetName = netName; this.AttrColumn = attrColumn; this.PropertyInfo = prop; this.AttrIgnore = attrIgnore; }