日期:2014-05-16 浏览次数:21793 次
public HNSServerEntities()
: base("name=HNSServerEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();//移除复数表名的契约
modelBuilder.Conventions.Remove<IncludeMetadataConvention>();//移除对MetaData表的查询验证,要不然每次都要访问EdmMetadata这个表
//数据库与实体映射
modelBuilder.Entity<TAB_SENSOR>().ToTable("tab_sensor_20130529");
//throw new UnintentionalCodeFirstException();
}