Get Column DataType from Entity Framework Entity
Using Entity Framework 5, database first. Is it possible (at run time) to get the data type of the database column that an entity's property represents? The .net type would also work fine if that's easier. IEnumerable<DbEntityEntry> entities = context.ChangeTracker.Entries() .Where( e => e.State == EntityState.Added || e.State == EntityState.Modified); foreach (DbEntityEntry entity in entities) { foreach (string propertyName in entity.CurrentValues.PropertyNames) { //so I know the entity and the property name. Can I get the data type? } } Use reflection on the entity to get the property info.