To get database table name on Entity framework 4.0 I do:
ObjectSetInstance.EntitySet.ToString()
Is there a way to do this on Entity Framewo
You can try something like this.
private string GetTableName(Type type)
{
var tableAttribute = type.GetCustomAttributes(false).OfType().FirstOrDefault();
return tableAttribute == null ? type.Name : tableAttribute.Name;
}
You can call this string like this.
var tableName = GetTableName(entityType.FirstOrDefault());
Please see the below link for further info. Link