Question

I am using MVC4 ,T4 Scaffolding and EF5. I Created a model,

namespace wbtest.Models
{
[Table(name: "Pay_Employees_Mst", Schema = "Test")]
public class Employee
 {
public int EMPLOYEE_ID { get; set; }
public string EMPLOYEE_CODE { get; set; }
}
}

I need to get the annotation of table name "Pay_Employees_Mst" for db context .Currently getting ModelName Employee.

Please Help.

Was it helpful?

Solution

I got it through,

String entityName1 = (context as System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext
  .CreateObjectSet<Employee>()
  .EntitySet.Name;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top