Quantcast
Channel: Entity Framework
Viewing all articles
Browse latest Browse all 10318

Updated Wiki: Design Meeting Notes - April 2, 2013

$
0
0

API Review: Multiple Contexts per Database & Configurable Migrations History Table

The purpose of API Review meetings is to go over new API surface one class/member at a time to ensure we have a consistent and high quality API. We look at how classes are structured, which members are public as well as the names of classes, members and parameters.

 

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.

 

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.)


Viewing all articles
Browse latest Browse all 10318

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>