API Review: Multiple Contexts per Database

System.Data.Entity.Migrations.DbMigrationsConfiguration

  • public string ContextKey

Context key isn't technically correct because we actually use the configuration class name as the key.

Discussed and decided most people think of this as the key for their context so we will leave it as-is.

System.Data.Entity.DbModelBuilder

  • public virtual DbModelBuilder HasDefaultSchema(string schema)

No changes needed.

 

API Review: Migrations History Table Customization

System.Data.Entity.Migrations.DbMigrationsConfiguration

  • public IHistoryContextFactory HistoryContextFactory

System.Data.Entity.Migrations.History.IHistoryContextFactory

  • HistoryContext Create(DbConnection existingConnection, bool contextOwnsConnection, string defaultSchema)

Action Item: We should remove IHistoryContextFactory and just use a Func<HistoryContext>

Opened CodePlex issue: http://entityframework.codeplex.com/workitem/1009

This will be consistent with what we've done in some other areas

System.Data.Entity.Migrations.History.HistoryContext

  • public const string TableName
  • public HistoryContext(DbConnection existingConnection, bool contextOwnsConnection, string defaultSchema)
  • protected override void OnModelCreating(DbModelBuilder modelBuilder)
  • public string CacheKey { get; }
  • protected string DefaultSchema { get; }
  • public virtual IDbSet<HistoryRow> History { set; get; }

Action Item: CacheKey should be virtual

  • We discussed making it an explicit implementation of IDbModelCacheKeyProvider but decided there may be scenarios where people need to override it (when their custom OnModelCreating can build a different model for the same provider/default schema pair).

Action Item: We should rename TableName to DefaultTableName to make it clearer

System.Data.Entity.Migrations.History.HistoryRow

  • public string ContextKey { set; get; }
  • public string MigrationId { set; get; }
  • public byte[] Model { set; get; }
  • public string ProductVersion { set; get; }

Discussed whether this should be HistoryEntry instead. We decided either would be ok and since this has been public for a while we'll just leave it as-is.

Action Item: Need to remove doc comments about this just being public for partial trust (since it's now public to allow config in OnModelCreating etc.)

Last edited Apr 2, 2013 at 10:04 PM by RoMiller, version 2

Comments

No comments yet.