public static IEnumerable <Tuple <string, string, int?, int?> > GetColumnInfo <T>(this EntityTypeConfiguration <T> map) where T : class { IEnumerable properties = map.GetConfiguration() ?.GetPropertyValue("PrimitivePropertyConfigurations") as IEnumerable; if (properties == null) { yield break; } foreach (object property in properties) { string propertyString = $"{property.GetPropertyValue("Key")}"; string columnType = property.GetPropertyValue("Value") .GetPropertyValue("ColumnType") as string; int?columnIndex = property.GetPropertyValue("Value") .GetPropertyValue("ColumnOrder") as int?; int?maxLength = property.GetPropertyValue("Value") .GetPropertyValue("MaxLength") as int?; yield return(new Tuple <string, string, int?, int?>(propertyString, columnType, columnIndex, maxLength)); } }
public static string GetTableName <T>(this EntityTypeConfiguration <T> map) where T : class { return(map.GetConfiguration() .GetProperty("TableName") .GetValue(map.GetConfiguration()) as string); }