TBC across assemblies RRS feed

  • Question

  • Hi,

    in EF 4.2 I have extended my DbContext across multiple assemblies. Most of my entities (across the solution) inherit from a common base-class 'BaseTrackingEntity'.

    After creating an (optional) strategy 'DateLastModifiedConcurrencyCheckStrategy' (see code below), all entities were suddenly in ONE table 'BaseTrackingEntity'. So I added the Table annotation to all inheriting entities (argh!) and also used the fluent API to call modelBuilder.Entity<Invoice>().Map(c => c.MapInheritedProperties()). Now the tables are all there again, but the following side-effects are there:

    1. the table for the abstract base-class is still there (dbo.BaseTrackingEntities) - I guess it's not actually used for any data-persistence, though

    2. no more foreign-keys are being generated in the Database

    Does anyone have a clue?

    public void OnModelCreating(DbModelBuilder modelBuilder)
     var config = new EntityTypeConfiguration<BaseTrackingEntity>();
     config.Property(p => p.DateLastModified).IsConcurrencyToken();
     //TODO: make BaseTrackingEntities table disappear in DB

    regards, Tilli
    Sunday, January 8, 2012 5:36 PM

All replies