/// <summary> /// Take all the info we've gathered form constructors, parameters, attributes, etc. and build the map /// </summary> protected void MapFromTemporaryFields() { foreach (var item in temporaryFieldInfo.Values) { // Logic: using default (!excludeproperties) handling, anything with a public getter is included automatically. // In addition, only things identified in some way should be included. if ((!ExcludeProperties && item.HasPublicGetter) || item.FieldAttr || item.PK) { string nameLower = item.Name.ToLower(); //fieldNames.Add(item.Name); //sqlFieldNames.Add(item.SqlName); // use the best SqlName - if not present in the default data source, then get from the property name string sqlName = String.IsNullOrEmpty(item.SqlName) ? item.Name : item.SqlName; IDBFieldInfo fldInfo = new DBFieldInfo(item.PropInfo, sqlName, isPk: item.PK, ignoreNull: item.IgnoreNull, isReadOnly: item.ReadOnly); if (item.PK) { if (PrimaryKey != null) { throw new Exception("A different primary key '" + PrimaryKey.Name + "' has already been identified, cannot make '" + item.Name + "' the pk."); } PrimaryKey = fldInfo; } fieldInfo.Add(fldInfo); fieldIndexMap[nameLower] = fieldInfo.Count - 1; } } if (PrimaryKey == null && fieldInfo.Count > 0) { PrimaryKey = fieldInfo[0]; ((DBFieldInfo)fieldInfo[0]).IsPrimaryKey = true; } temporaryFieldInfo = null; }
/// <summary> /// Take all the info we've gathered form constructors, parameters, attributes, etc. and build the map /// </summary> protected void MapFromTemporaryFields() { foreach (var item in temporaryFieldInfo.Values) { // Logic: using default (!excludeproperties) handling, anything with a public getter is included automatically. // In addition, only things identified in some way should be included. if ((!ExcludeProperties && item.HasPublicGetter) || item.FieldAttr || item.PK) { string nameLower = item.Name.ToLower(); //fieldNames.Add(item.Name); //sqlFieldNames.Add(item.SqlName); // use the best SqlName - if not present in the default data source, then get from the property name string sqlName = String.IsNullOrEmpty(item.SqlName) ? item.Name : item.SqlName; IDBFieldInfo fldInfo = new DBFieldInfo(item.PropInfo, sqlName, isPk: item.PK, ignoreNull: item.IgnoreNull, isReadOnly: item.ReadOnly); if (item.PK) { if (PrimaryKey != null) { throw new Exception("A different primary key '" + PrimaryKey.Name + "' has already been identified, cannot make '" + item.Name + "' the pk."); } PrimaryKey = fldInfo; } fieldInfo.Add(fldInfo); fieldIndexMap[nameLower] = fieldInfo.Count - 1; } } if (PrimaryKey == null && fieldInfo.Count>0) { PrimaryKey = fieldInfo[0]; ((DBFieldInfo)fieldInfo[0]).IsPrimaryKey = true; } temporaryFieldInfo = null; }