我有带有(id,...)的数据库 ObjectTypes。我希望在我的模型(EF 4)中在某些表外键中添加来自我的数据库的引用以引用 objectTypes.dbo.ObjectTypes 字段。我怎样才能做到这一点?
public class KOATUUContext : DbContext
{
static KOATUUContext()
{
Database.SetInitializer<KOATUUContext>(null);
}
public KOATUUContext()
: base("KOATUU")
{
}
public DbSet<KOATUU> KOATUUs { get; set; }
public DbSet<Region> Regions { get; set; }
public DbSet<TerType> TerTypes { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new KOATUUMap());
modelBuilder.Configurations.Add(new RegionMap());
modelBuilder.Configurations.Add(new TerTypeMap());
base.OnModelCreating(modelBuilder);
}
}