Example #1
0
        private void Remove(ColumnNameToPropertyName columnNameToPropertyName, bool favorTable)
        {
            // favoring single return queries for readability; despite performance hit
            ColumnNameToPropertyName toRemove = favorTable ? ColumnNamesToPropertyNames.FirstOrDefault(c => c.TableName.Equals(columnNameToPropertyName.TableName) && c.ColumnName.Equals(columnNameToPropertyName.ColumnName)) : ColumnNamesToPropertyNames.FirstOrDefault(c => c.TableName.Equals(columnNameToPropertyName.TableName) && c.PropertyName.Equals(columnNameToPropertyName.PropertyName));

            if (toRemove != null)
            {
                ColumnNamesToPropertyNames.Remove(toRemove);
            }
        }
Example #2
0
        public string GetPropertyName(string tableName, string columName)
        {
            ColumnNameToPropertyName lookup = ColumnNamesToPropertyNames.FirstOrDefault(c => c.TableName.Equals(tableName) && c.ColumnName.Equals(columName));

            if (lookup != null)
            {
                return(lookup.PropertyName);
            }

            return(columName);
        }
Example #3
0
        public string GetColumnName(string className, string propertyName)
        {
            string tableName = GetTableName(className);
            ColumnNameToPropertyName lookup = ColumnNamesToPropertyNames.FirstOrDefault(c => c.TableName.Equals(tableName) && c.PropertyName.Equals(propertyName));

            if (lookup != null)
            {
                return(lookup.ColumnName);
            }

            return(propertyName);
        }
Example #4
0
 public void Set(ColumnNameToPropertyName columnNameToPropertyName)
 {
     Remove(columnNameToPropertyName, true);
     Remove(columnNameToPropertyName, false);
     ColumnNamesToPropertyNames.Add(columnNameToPropertyName);
 }