[英]Get The Table Name Of Model In T4 Template
I am using MVC4 ,T4 Scaffolding and EF5. 我正在使用MVC4,T4脚手架和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. 我需要为数据库上下文获取表名称“ Pay_Employees_Mst”的注释。当前正在获取ModelName Employee。
Please Help. 请帮忙。
I got it through, 我说完了
String entityName1 = (context as System.Data.Entity.Infrastructure.IObjectContextAdapter).ObjectContext
.CreateObjectSet<Employee>()
.EntitySet.Name;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.