<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>entityframework Wiki Rss Feed</title><link>http://entityframework.codeplex.com/</link><description>entityframework Wiki Rss Description</description><item><title>Updated Wiki: specs</title><link>https://entityframework.codeplex.com/wikipage?title=specs&amp;version=46</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Entity Framework 6&lt;/h1&gt;
&lt;p&gt;As we work on EF6 we will be creating feature specifications, walkthroughs and other documentation.&lt;/p&gt;
&lt;h3&gt;Runtime&lt;/h3&gt;
&lt;p&gt;Here is a list of the new features in the EF6 runtime and the documentation we have created for them.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Async Query and Save&lt;/strong&gt; adds support for the task-based asynchronous patterns that were introduced in .NET 4.5. We've created a
&lt;a href="http://msdn.microsoft.com/en-us/data/jj819165"&gt;walkthrough&lt;/a&gt; and a &lt;a href="http://entityframework.codeplex.com/wikipage?title=Task-based%20Asynchronous%20Pattern%20support%20in%20EF."&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Custom Code First Conventions&lt;/strong&gt; allow write your own conventions to help avoid repetitive configuration. We provide a simple API for lightweight conventions as well as some more complex building blocks to allow you to author more complicated
 conventions. We&amp;rsquo;ve created a &lt;a href="http://msdn.microsoft.com/en-us/data/jj819164"&gt;
walkthough&lt;/a&gt; and a &lt;a href="http://entityframework.codeplex.com/wikipage?title=Custom%20Conventions"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Code First Mapping to Insert/Update/Delete Stored Procedures&lt;/strong&gt; is now supported. We&amp;rsquo;ve created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Code%20First%20Insert%2fUpdate%2fDelete%20Stored%20Procedure%20Mapping"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Connection Resiliency&lt;/strong&gt; enables automatic recovery from transient connection failures. The
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Connection%20Resiliency%20Spec"&gt;
feature specification&lt;/a&gt; shows how to enable this feature and how to create your own retry policies.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Dependency Resolution&lt;/strong&gt; introduces support for the Service Locator pattern and we've factored out some pieces of functionality that can be replaced with custom implementations. We&amp;rsquo;ve created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=EF%20Configuration%20and%20Extensibility"&gt;
feature specification&lt;/a&gt; and a &lt;a href="http://msdn.microsoft.com/en-us/data/jj680697"&gt;
list of services that can be injected&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Code-Based Configuration&lt;/strong&gt; gives you the option of performing configuration &amp;ndash; that was traditionally performed in a config file &amp;ndash; in code. We've created an
&lt;a href="http://msdn.microsoft.com/en-us/data/jj680699"&gt;overview with some examples&lt;/a&gt; and a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Code-based%20Configuration"&gt;
feature specification&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Interception/SQL logging &lt;/strong&gt;provides low-level building blocks for interception of EF operations with simple SQL logging built on top. We've created a&amp;nbsp;&lt;a href="https://entityframework.codeplex.com/wikipage?title=Interception"&gt;feature
 specification&lt;/a&gt;&amp;nbsp;for this feature and Arthur Vickers has created a &lt;a href="http://blog.oneunicorn.com/2013/05/08/ef6-sql-logging-part-1-simple-logging/"&gt;
multi-part blog series &lt;/a&gt;covering&amp;nbsp;this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Configurable Migrations History Table&lt;/strong&gt; allows you to customize the definition of the migrations history table. This is particularly useful for database providers that require the appropriate data types etc. to be specified for the Migrations
 History table to work correctly. We&amp;rsquo;ve created a &lt;a href="http://entityframework.codeplex.com/wikipage?title=Migrations%20History%20Table%20Customization"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Multiple Contexts per Database&lt;/strong&gt; removes the previous limitation of one Code First model per database when using Migrations or when Code First automatically created the database for you. We&amp;rsquo;ve created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Multi-tenant%20Migrations"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbModelBuilder.HasDefaultSchema&lt;/strong&gt; is a new Code First API that allows the default database schema for a Code First model to be configured in one place. Previously the Code First default schema was hard-coded to &amp;quot;dbo&amp;quot; and the only way to configure
 the schema to which a table belonged was via the ToTable API. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Enums, Spatial and Better Performance on .NET 4.0&lt;/strong&gt; - By moving the core components that used to be in the .NET Framework into the EF NuGet package we are now able to offer enum support, spatial data types and the performance improvements
 from EF5 on .NET 4.0. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbContext can now be created with a DbConnection that is already opened
&lt;/strong&gt;which enables scenarios where it would be helpful if the connection could be open when creating the context (such as sharing a connection between components where you can not guarantee the state of the connection).
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Default transaction isolation level is changed to READ_COMMITTED_SNAPSHOT&lt;/strong&gt; for databases created using Code First, potentially allowing for more scalability and fewer deadlocks.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbContext.Database.UseTransaction and DbContext.Database.BeginTransaction&lt;/strong&gt; are new APIs that enable scenarios where you need to manage your own transactions.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Improved performance of Enumerable.Contains in LINQ queries&lt;/strong&gt;.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Significantly improved warm up time (view generation) &lt;/strong&gt;&amp;ndash; especially for large models &amp;ndash; as the result of a contribution from
&lt;a href="http://www.codeplex.com/site/users/view/AlirezaHaghshenas"&gt;AlirezaHaghshenas&lt;/a&gt;.&amp;nbsp;
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbModelBuilder.Configurations.AddFromAssembly method&lt;/strong&gt;&amp;nbsp; was contributed by
&lt;a href="http://www.codeplex.com/site/users/view/UnaiZorrilla"&gt;UnaiZorrilla&lt;/a&gt;. If you are using configuration classes with the Code First Fluent API, this method allows you to easily add all configuration classes defined in an assembly.&amp;nbsp;
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Custom Migrations Operations&lt;/strong&gt; were enabled by a contribution from
&lt;a href="http://www.codeplex.com/site/users/view/iceclow"&gt;iceclow&lt;/a&gt; and &lt;a href="http://romiller.com/2013/02/27/ef6-writing-your-own-code-first-migration-operations/"&gt;
this blog post&lt;/a&gt; provides an example of using this new feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Pluggable Pluralization &amp;amp; Singularization Service &lt;/strong&gt;was contributed by
&lt;a href="http://www.codeplex.com/site/users/view/UnaiZorrilla"&gt;UnaiZorrilla&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Improved Transaction Support &lt;/strong&gt;updates the Entity Framework to provide support for a transaction external to the framework as well as improved ways of creating a transaction within the Framework. See this
&lt;a href="wikipage?title=Improved%20Transaction%20Support"&gt;feature specification&lt;/a&gt; for details.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Improved POCO support&lt;/strong&gt;. Entity and complex types can now be nested inside classes and can have
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Support%20of%20POCO%20entities%20with%20custom%20Equals%20and%20GetHashCode%20implementations"&gt;
custom implementations of Equals or GetHashCode&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Tooling&lt;/h3&gt;
&lt;p&gt;Here are the changes and features we are planning for the EF6 tooling.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://entityframework.codeplex.com/wikipage?title=EF6%20Tooling"&gt;The Basics&lt;/a&gt;
&lt;/strong&gt;covers things that aren&amp;rsquo;t classified as features but are required to provide a good tooling experience. Topics include branding, installation, supported VS versions, supported EF versions, etc.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Tooling Consolidation&lt;/strong&gt; will combine the EF Power Tools and the EF Designer to provide a single set of tooling with a single wizard for creating new models. We&amp;rsquo;ve created a
&lt;a href="wikipage?title=Tooling%20Consolidation"&gt;feature specification&lt;/a&gt; for this feature.
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Other Documentation&lt;/h3&gt;
&lt;p&gt;In addition to new features, here are some other topics relevant to EF6.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Updated Provider Model&lt;/strong&gt; - In previous versions of EF some of the core components were a part of the .NET Framework. In EF6 we've moved all these components into our NuGet package, allowing us to develop and deliver more features in a shorter
 time frame. This move required some changes to our provider model. We've created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Rebuilding%20EF%20providers%20for%20EF6"&gt;
document&lt;/a&gt; that details the changes required by providers to support EF6, and provided a
&lt;a href="http://msdn.microsoft.com/en-us/data/jj730568"&gt;list of providers&lt;/a&gt; that we are aware of with EF6 support.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Upgrading Applications to EF6&lt;/strong&gt; &amp;ndash; In some cases you may need to update your EF5 code to work with EF6, see
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6"&gt;
Updating Applications to use EF6&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Entity Framework 5&lt;/h1&gt;
&lt;p&gt;The EF5 release was largely completed prior to moving to CodePlex, these documents only include the final set of changes made in EF5.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/wikipage?title=DbContextDefaultCodeGenForDesigner"&gt;Making the Designer use EF5 NuGet Package&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="/wikipage?title=EF5ContentPlan"&gt;Content Plan&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Backlog&lt;/h1&gt;
&lt;p&gt;These documents are for features that have not yet been assigned a release.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Schema%20Information"&gt;Schema Information&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Implicit%20boundaries%20in%20LINQ%20to%20Entities%20%28a.k.a.%20client-side%20evaluation%29&amp;version=2"&gt;Implicit boundaries in LINQ to Entities (client-side evaluation)&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoMiller</author><pubDate>Thu, 23 May 2013 22:00:40 GMT</pubDate><guid isPermaLink="false">Updated Wiki: specs 20130523100040P</guid></item><item><title>New Comment on "Code First Insert/Update/Delete Stored Procedure Mapping"</title><link>https://entityframework.codeplex.com/wikipage?title=Code First Insert/Update/Delete Stored Procedure Mapping&amp;ANCHOR#C27561</link><description>Is it possible &amp;#40;or will it be possible&amp;#41; to provide a stored procedure parameter that is not a property on the entity&amp;#63;  We have stored procedures that take in an additional parameter for the current user id for logging purposes.&amp;#10;&amp;#10;Thanks&amp;#33;</description><author>trageley</author><pubDate>Wed, 22 May 2013 14:24:06 GMT</pubDate><guid isPermaLink="false">New Comment on "Code First Insert/Update/Delete Stored Procedure Mapping" 20130522022406P</guid></item><item><title>New Comment on "Improved Transaction Support"</title><link>https://entityframework.codeplex.com/wikipage?title=Improved Transaction Support&amp;ANCHOR#C27557</link><description>I don&amp;#39;t think the factories will be a good replacement. I am trying to embed EF as part of a framework that keeps its own context with database&amp;#40;s&amp;#41; and tracks transactions on them - without this EF6 addition I was dead in the water&amp;#33; The problem is it is extremely inconvenient to use ambient transactions &amp;#40;not even considering the additional dependencies&amp;#41; and the fact that the framework in question manages longer-living contexts - i.e. there are no using &amp;#123; &amp;#125; blocks there - instead it takes care for the disposal of everything at the right stages and the developer can access or auto open &amp;#40;connections&amp;#41; auto start &amp;#40;transactions&amp;#41; from different points in a complex pipeline. So, without a way to attach the EF context to the transaction it seems that my options are not pretty.</description><author>michaelelfial</author><pubDate>Tue, 21 May 2013 22:09:37 GMT</pubDate><guid isPermaLink="false">New Comment on "Improved Transaction Support" 20130521100937P</guid></item><item><title>New Comment on "Roadmap"</title><link>https://entityframework.codeplex.com/wikipage?title=Roadmap&amp;ANCHOR#C27556</link><description>&amp;#43;1 for &amp;#39;Unique constraints&amp;#47;alternate&amp;#47;natural keys&amp;#39; - &amp;#91;Unique&amp;#93; data annotation on models please&amp;#33;</description><author>niico</author><pubDate>Tue, 21 May 2013 20:38:06 GMT</pubDate><guid isPermaLink="false">New Comment on "Roadmap" 20130521083806P</guid></item><item><title>New Comment on "Documentation"</title><link>https://entityframework.codeplex.com/documentation?&amp;ANCHOR#C27508</link><description>when i build the whole solution,i can&amp;#39;t find any tests in test explorer,&amp;#10;i have install the xunit for vs2012&amp;#40;with sp2&amp;#41;.&amp;#10;who can give me a hand&amp;#63;thanks</description><author>huoxudong125</author><pubDate>Fri, 17 May 2013 09:57:19 GMT</pubDate><guid isPermaLink="false">New Comment on "Documentation" 20130517095719A</guid></item><item><title>Updated Wiki: Design Meeting Notes</title><link>https://entityframework.codeplex.com/wikipage?title=Design Meeting Notes&amp;version=62</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Entity Framework Design Meeting Notes&lt;/h1&gt;
&lt;p&gt;The Entity Framework team has a weekly design meeting in which we discuss/recap design and other issues with the codebase. These are the notes from those meetings. The intention is to provide a history of what decisions have been made and why. No attempt
 is made to go back and update notes from older meetings if we later change a decision and decide to do something different.&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20May%2016%2c%202013"&gt;May 16, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Time format in DbCommandLogger &lt;/li&gt;&lt;li&gt;Potential breaking change to IDbSet &lt;/li&gt;&lt;li&gt;Conversion to lightweight conventions&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20May%209%2c%202013"&gt;May 9, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Interception building blocks &lt;/li&gt;&lt;li&gt;DbContext.Database.Log&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20April%2011%2c%202013"&gt;April 11, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Default providers
&lt;ul&gt;
&lt;li&gt;The default connection factory &lt;/li&gt;&lt;li&gt;Default provider configuration &lt;/li&gt;&lt;li&gt;Additional config file elements &lt;/li&gt;&lt;li&gt;DbProviderServices methods&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Model-based conventions exploratory testing&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20April%204%2c%202013"&gt;April 4, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Revisit: Using ExecuteSqlCommand without a transaction &lt;/li&gt;&lt;li&gt;Revisit: Extension method class naming &lt;/li&gt;&lt;li&gt;New transient error codes &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20April%202%2c%202013"&gt;April 2, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;API Review: Multiple Contexts per Database &lt;/li&gt;&lt;li&gt;API Review: Configurable Migrations History Table &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%28March%2021%2c%202013"&gt;March 28, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Rename of DbExtensions to IQueryableExtensions &lt;/li&gt;&lt;li&gt;Pattern for customizing migrations history table &lt;/li&gt;&lt;li&gt;Turning off automatic transaction creation &lt;/li&gt;&lt;li&gt;Buffering in EntityClient &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2021%2c%202013"&gt;March 21, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Missing property handling in lightweight conventions &lt;/li&gt;&lt;li&gt;Code First stored procedure mapping &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2019%2c%202013"&gt;March 19, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Connection Resiliency Review &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2018%2c%202013"&gt;March 18, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Async Query &amp;amp; Save API Review &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2014%2c%202013"&gt;March 14, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;File/code-based configuration precedence &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2013%2c%202013"&gt;March 13, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Custom Code First Conventions &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%207%2c%202013"&gt;March 7, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Custom migration operations usability &lt;/li&gt;&lt;li&gt;WrapService naming &lt;/li&gt;&lt;li&gt;Database initializers and shared databases &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%2028%2c%202013"&gt;February 28, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Models with nested types in Code First &lt;/li&gt;&lt;li&gt;Configuration of connection resiliency execution strategy &lt;/li&gt;&lt;li&gt;Behavior of disposed DbContextTransaction &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%2020%2c%202013"&gt;February 20, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Mapping to fields &lt;/li&gt;&lt;li&gt;Removal of unused resources &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%2014%2c%202013"&gt;February 14, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Branching for EF releases &lt;/li&gt;&lt;li&gt;Pull request: extending Migrations &lt;/li&gt;&lt;li&gt;Code First: modification function mapping API (mapping to stored procs) &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%207%2c%202013"&gt;February 7, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;DbContext and transactions (continued) &lt;/li&gt;&lt;li&gt;Pull request: extending Migrations &lt;/li&gt;&lt;li&gt;Issues with SQL Server spatial types &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2031%2c%202013"&gt;January 31, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;DbContext and transactions &lt;/li&gt;&lt;li&gt;Code First: modification function mapping (mapping to stored procs) &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2024%2c%202013"&gt;January 24, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Buffering data reader perf &lt;/li&gt;&lt;li&gt;Provider-agnostic testing &lt;/li&gt;&lt;li&gt;Porting old SQL tests &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2017%2c%202013"&gt;January 17, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Metadata API surface &lt;/li&gt;&lt;li&gt;Pluralization service exploratory testing feedback &lt;/li&gt;&lt;li&gt;Metadata unification &lt;/li&gt;&lt;li&gt;Porting existing SQL tests &lt;/li&gt;&lt;li&gt;How should pluralizers be made available? &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2010%2c%202013"&gt;January 10, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Clustered/non-clustered unique identifier primary keys and SQL Azure &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20December%2013%2c%202012"&gt;December 13, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;Clustered/non-clustered unique identifier primary keys &lt;/li&gt;&lt;li&gt;Potential contribution for pluralization service &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20December%206%2c%202012"&gt;December 6, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Additional ObjectContext and EntityConnection constructors &lt;/li&gt;&lt;li&gt;Default schema changes during initialization &lt;/li&gt;&lt;li&gt;Making EF queries buffer by default &lt;/li&gt;&lt;li&gt;SQL Azure connection resiliency &lt;/li&gt;&lt;li&gt;WET, DAMP, or DRY tests &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%2029%2c%202012"&gt;November 29, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Handling pull requests &lt;/li&gt;&lt;li&gt;Making READ_COMMITTED_SNAPSHOT the default &lt;/li&gt;&lt;li&gt;Database First WinForms data binding &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%2020%2c%202012"&gt;November 20, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Automatic EntityTypeConfiguration discovery &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%2015%2c%202012"&gt;November 15, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;View generation API &lt;/li&gt;&lt;li&gt;Removal of Code Contracts &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%208%2c%202012"&gt;November 8, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;Connection resiliency to transient failures &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20October%2025%2c%202012"&gt;October 25, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Change default mapping for DateTime &lt;/li&gt;&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;DbConfiguration exploratory testing &lt;/li&gt;&lt;li&gt;Code Contracts discussion &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20October%2011%2c%202012"&gt;October 11, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20October%204%2c%202012"&gt;October 4, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Global spatial provider &lt;/li&gt;&lt;li&gt;Set-based configuration &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20September%2027%2c%202012"&gt;September 27, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Dependency resolver scoping &lt;/li&gt;&lt;li&gt;Sugar methods for services &lt;/li&gt;&lt;li&gt;Simplified API for common conventions &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20September%2020%2c%202012"&gt;September 20, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;By-convention parameter binding SqlQuery overload &lt;/li&gt;&lt;li&gt;SqlCE relative path connection string UX issues with Migrations &lt;/li&gt;&lt;li&gt;Pluggable Conventions &lt;/li&gt;&lt;li&gt;Polish the conventions API &lt;/li&gt;&lt;li&gt;Breaking change &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20August%2023%2c%202012"&gt;August 23, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Make ObjectContext implement IObjectContextAdapter &lt;/li&gt;&lt;li&gt;Migrations multi-tenancy &lt;/li&gt;&lt;li&gt;Designer versioning &lt;/li&gt;&lt;li&gt;Async protection &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20August%209%2c%202012"&gt;August 9, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Getting schema Information from providers &lt;/li&gt;&lt;li&gt;Using IDbDependencyResolver with existing IoC containers &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20August%202%2c%202012"&gt;August 2, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;CUD Batching &lt;/li&gt;&lt;li&gt;Bulk operations &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20July%2026%2c%202012"&gt;July 26, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Async &lt;/li&gt;&lt;li&gt;One-pagers &lt;/li&gt;&lt;li&gt;Initializer proposal &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20July%2012%2c%202012"&gt;July 12, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Model key caching &lt;/li&gt;&lt;li&gt;Migrations history table schema changes &lt;/li&gt;&lt;li&gt;Async immediate LINQ operators &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20July%205%2c%202012"&gt;July 5, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Refactoring and unit tests &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%2028%2c%202012"&gt;June 28, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Code contracts &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%2021%2c%202012"&gt;June 21, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Code-based configuration &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%2014%2c%202012"&gt;June 14, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Making database connections in the test suite more configurable &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%207%2c%202012"&gt;June 7, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Naming convention for static readonly and const fields &lt;/li&gt;&lt;li&gt;How will we handle breaking changes in EF6? &lt;/li&gt;&lt;li&gt;High-level ideas for using dependency injection with EF and specifics for the provider
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20May%2031%2c%202012"&gt;May 31, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Making EF code more testable &lt;/li&gt;&lt;li&gt;Code duplication in Async &lt;/li&gt;&lt;li&gt;Supporting MVC scaffolding &lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Fri, 17 May 2013 02:14:32 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Design Meeting Notes 20130517021432A</guid></item><item><title>Updated Wiki: Design Meeting Notes - May 16, 2013</title><link>https://entityframework.codeplex.com/wikipage?title=Design Meeting Notes - May 16, 2013&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Design Meeting Notes - May 16, 2013&lt;/h1&gt;
&lt;h2&gt;Time format in DbCommandLogger&lt;/h2&gt;
&lt;p&gt;It was suggested in a CodePlex discussion that the “executing at” time in the default DbCommandLogger output should be UTC time. This was discussed and the universal feeling on the team was that in this case local time formatted to current culture is preferable.
 The reason for this is that the “timestamp” is not a timestamp designed to be used in the index of a log file or to be saved in an automated logging operation. It is instead a much more “conversational” log designed to produce human readable content probably
 of most use in debugging. As such, the local time seems more appropriate and useful. However, we will look into adding time zone info to the output&amp;nbsp; to make this absolutely clear. See
&lt;a href="https://entityframework.codeplex.com/workitem/1151"&gt;CodePlex 1151&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;There was also discussion about whether or not the timestamp is even useful enough to include. The marginal opinion was that we should keep it, with the first person who can document a real-world case where it was useful getting a free beer.&lt;/p&gt;
&lt;h2&gt;Potential breaking change to IDbSet&lt;/h2&gt;
&lt;p&gt;The DbSet classes (generic and non-generic) inherit from a (generic or non-generic) IDbSet interface. IDbSet is intended only for creating test doubles, be these mocks or fakes. However, in EF6 DbSet has changed in four ways that if reflected in equivalent
 changes for IDbSet would be breaking changes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;FindAsync added &lt;/li&gt;&lt;li&gt;AddRange/RemoveRange added &lt;/li&gt;&lt;li&gt;Local return type changed to DbLocalView (this change may be reverted anyway)&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The options discussed were:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make the breaking change
&lt;ul&gt;
&lt;li&gt;EF6 has no binary compat story to EF5 anyway because of the move out of the Framework
&lt;/li&gt;&lt;li&gt;This is the easiest for anyone using a mocking framework such as Moq which will automatically handle the new members
&lt;/li&gt;&lt;li&gt;Manually created test doubles will break and need to be updated &lt;/li&gt;&lt;li&gt;Doing this now leaves us in the same state the next time we want to add something to DbSet at which time there will hopefully be a binary compat story&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Make DbSet more mockable
&lt;ul&gt;
&lt;li&gt;These means adding a protected constructor and making methods virtual &lt;/li&gt;&lt;li&gt;Note that a type derived from DbSet that uses the protected constructor would create an object not be bound to any context and the methods would be no-ops. This makes it very like IDbSet from the perspective of creating test doubles.
&lt;/li&gt;&lt;li&gt;If we took this option we could potentially obsolete IDbSet &lt;/li&gt;&lt;li&gt;It’s worth noting that no cases have been identified where this would be functionally different to using IDbSet for test doubles. However, there is strong feeling in the community that interfaces are preferred.&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Introduce an abstract base class
&lt;ul&gt;
&lt;li&gt;This is essentially the same as the previous option except that DbSet itself stays the same and an abstract base class is instead inserted underneath it
&lt;/li&gt;&lt;li&gt;This has the advantage that it provides a way to communicate what the base type is for (test doubles)
&lt;/li&gt;&lt;li&gt;However, it adds a class that doesn’t really need to be there and means that you have to use this base class in your context if you ever want to use test doubles&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Use extension methods with delegation
&lt;ul&gt;
&lt;li&gt;We have a pattern that we use for Include where the new members are added as extension methods which then delegate quickly into the real DbSet if the IDbSet is a real DbSet and otherwise use Reflection to call a method with the same signature on the test
 double &lt;/li&gt;&lt;li&gt;This works okay, but the pattern is obscure and people would likely have to know that the extension methods work in this way to use it effectively. Also, even when it is known that the extension method works in this way it can still be a bit confusing to
 see how to use this with a mocking framework.&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Create a new interface type (e.g. IDbSet2) that extends the original interface type
&lt;ul&gt;
&lt;li&gt;This meets all the requirements but is an ugly pattern that adds a new interface type when, conceptually, it is not needed. This gets even worse if we ever have to do it again.&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The decision was to make DbSet more mockable. However, we will not obsolete IDbSet because this would create work for those currently using IDbSet who don’t need to use the new members. We will add guidance to IDbSet indicating that using DbSet is the way
 to go for new code and, depending on feedback, we may choose to obsolete IDbSet in a future release.&lt;/p&gt;
&lt;h2&gt;Conversion to lightweight conventions&lt;/h2&gt;
&lt;p&gt;The configuration conventions used by EF are being converted to lightweight conventions are part of the the process to remove the “traditional” configuration conventions. As expected this has exposed some issues in the lightweight API for things that cannot
 be done or cannot be done cleanly.&lt;/p&gt;
&lt;h3&gt;Navigation property configuration&lt;/h3&gt;
&lt;p&gt;It is currently not possible to configure navigation properties using lightweight conventions. We considered creating some version of the relationship mapping fluent API for lightweight conventions, but this API is both very tied to generic types and the
 filtering they allow and also much more appropriate for configuring individual relationships rather than multiple relationships as is usually the case for conventions.&lt;/p&gt;
&lt;p&gt;The proposed solution is to add a NavigationProperty method when using the Entities API that mirrors the Property method but has members suitable for navigation property configuration rather than scalar property configuration. We considered collapsing these
 into just one Property method but the intersection of members is very small. Also, if this API is reflected on the normal fluent API then it makes sense to separate the concepts both to retain the fluent type filtering and keep the two concepts conceptually
 separated.&lt;/p&gt;
&lt;p&gt;Sub-questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Should we have a top-level NavigationProperties method that mirrors the top-level Properties method? We decided not to do this now for two reasons:
&lt;ul&gt;
&lt;li&gt;We don’t have an actual scenario where we need it and while it is possible to think of some where it might be useful the only ones we could think of would not work because of the second reason:
&lt;/li&gt;&lt;li&gt;We have no way of knowing if the potential navigation property will remain a navigation property in the final model. This is because every reference between types is initially considered a navigation property. However, if at a later time one of the types
 is configured as a complex type or turned into a complex type by convention, then the potential navigation properties are no longer actual navigation properties.&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Should Properties also include navigation properties? We decided to not do this now for both the same reasons that we are not doing NavigationProperties and also because it is consistent with other APIs that navigation properties be considered differently
 from scalar properties.
&lt;ul&gt;
&lt;li&gt;We could choose to have an additional common API in the future, similar to what we have for the DbContext change tracker API.&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Should we introduce a NavigationProperty API on the non-conventions fluent API?
&lt;ul&gt;
&lt;li&gt;This will likely be needed for o/c mapping changes such as mapping to fields.
&lt;/li&gt;&lt;li&gt;We will not do this for EF6 because it isn’t needed for anything we are doing in this release, but we will likely introduce it in the future.&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Entities returning complex types&lt;/h3&gt;
&lt;p&gt;There are currently a few issues with the Entities methods:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Entities currently returns only entity types, but we now need Entities to return types that have been configured as complex types.
&lt;/li&gt;&lt;li&gt;Currently, some types returned by Entities may get later transformed into complex types, which can be confusing.
&lt;/li&gt;&lt;li&gt;Entities shows up before Entity in Intelisense, which is annoying.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Given this we will rename this method to “Types”. Note that any configuration done on a type that can be done on either a complex type or an entity type should not change whether or not change the type from a complex type to an entity type. On the other
 hand, explicitly configuring the type as a complex/entity type in the convention should be possible and honored. Also, configurations that imply and entity type (such as key configuration or navigation property configuration) should influence the complex type
 convention in the normal way.&lt;/p&gt;
&lt;h3&gt;ModelNamespaceConvention&lt;/h3&gt;
&lt;p&gt;ModelNamespaceConvention is the only convention that cannot be converted to lightweight conventions. This is a convention used by DbContext to set the model namespace to the DbContext namespace. This makes the EDM look nicer for those cases where the EDM
 is exposed, such as OData. It has always been possible to remove this convention, but never possible to use it to change the namespace in some other way. We have also not seen any requests to be able to do this. (The model namespace is never exposed for the
 vast majority of EF users.)&lt;/p&gt;
&lt;p&gt;Options are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add a property on DbModelBuilder and obsolete the convention. The problem with this is that it pollutes the model builder API for something that will hardly ever be used.
&lt;/li&gt;&lt;li&gt;Leave as is. This doesn’t substantially change the consolidation work and so is probably okay.
&lt;/li&gt;&lt;li&gt;Leave as is, but make the constructor public. This allows people to change the model namespace to something else if they want to.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;We will leave as is but make the constructor public. Making the constructor public has very little value but also a very low risk change such that there doesn’t seem like a reason not to do it.&lt;/p&gt;
&lt;h3&gt;Lightweight conventions are wrapped as configuration conventions&lt;/h3&gt;
&lt;p&gt;This is the mechanism that allows a lightweight convention to be factored into a class and then added with the traditional convention API. The question is whether or not this should change given the move to only use lightweight conventions? The decision
 was to leave the design as is since it seems to work generally as people expect including when the conventions get run. It would be possible to call Entities again inside the outer Entities call, and this would not work as expected, but this is not a natural
 pattern and doesn’t seem like something to be too concerned about.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Fri, 17 May 2013 02:11:40 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Design Meeting Notes - May 16, 2013 20130517021140A</guid></item><item><title>Updated Wiki: Design Meeting Notes - May 16, 2013</title><link>https://entityframework.codeplex.com/wikipage?title=Design Meeting Notes - May 16, 2013&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;-&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Thu, 16 May 2013 23:57:34 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Design Meeting Notes - May 16, 2013 20130516115734P</guid></item><item><title>New Comment on "specs"</title><link>https://entityframework.codeplex.com/wikipage?title=specs&amp;ANCHOR#C27491</link><description>One of the most important features that we expect EF support is batch processing for INSERT, UPDATE, DELETE. When will we support it &amp;#63; Or we will never support &amp;#63;</description><author>uyhung</author><pubDate>Wed, 15 May 2013 09:12:00 GMT</pubDate><guid isPermaLink="false">New Comment on "specs" 20130515091200A</guid></item><item><title>Updated Wiki: specs</title><link>https://entityframework.codeplex.com/wikipage?title=specs&amp;version=45</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Entity Framework 6&lt;/h1&gt;
&lt;p&gt;As we work on EF6 we will be creating feature specifications, walkthroughs and other documentation.&lt;/p&gt;
&lt;h3&gt;Runtime&lt;/h3&gt;
&lt;p&gt;Here is a list of the new features in the EF6 runtime and the documentation we have created for them.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Async Query and Save&lt;/strong&gt; adds support for the task-based asynchronous patterns that were introduced in .NET 4.5. We've created a
&lt;a href="http://msdn.microsoft.com/en-us/data/jj819165"&gt;walkthrough&lt;/a&gt; and a &lt;a href="http://entityframework.codeplex.com/wikipage?title=Task-based%20Asynchronous%20Pattern%20support%20in%20EF."&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Custom Code First Conventions&lt;/strong&gt; allow write your own conventions to help avoid repetitive configuration. We provide a simple API for lightweight conventions as well as some more complex building blocks to allow you to author more complicated
 conventions. We’ve created a &lt;a href="http://msdn.microsoft.com/en-us/data/jj819164"&gt;
walkthough&lt;/a&gt; and a &lt;a href="http://entityframework.codeplex.com/wikipage?title=Custom%20Conventions"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Code First Mapping to Insert/Update/Delete Stored Procedures&lt;/strong&gt; is now supported. We’ve created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Code%20First%20Insert%2fUpdate%2fDelete%20Stored%20Procedure%20Mapping"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Connection Resiliency&lt;/strong&gt; enables automatic recovery from transient connection failures. The
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Connection%20Resiliency%20Spec"&gt;
feature specification&lt;/a&gt; shows how to enable this feature and how to create your own retry policies.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Dependency Resolution&lt;/strong&gt; introduces support for the Service Locator pattern and we've factored out some pieces of functionality that can be replaced with custom implementations. We’ve created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=EF%20Configuration%20and%20Extensibility"&gt;
feature specification&lt;/a&gt; and a &lt;a href="http://msdn.microsoft.com/en-us/data/jj680697"&gt;
list of services that can be injected&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Code-Based Configuration&lt;/strong&gt; gives you the option of performing configuration – that was traditionally performed in a config file – in code. We've created an
&lt;a href="http://msdn.microsoft.com/en-us/data/jj680699"&gt;overview with some examples&lt;/a&gt; and a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Code-based%20Configuration"&gt;
feature specification&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Configurable Migrations History Table&lt;/strong&gt; allows you to customize the definition of the migrations history table. This is particularly useful for database providers that require the appropriate data types etc. to be specified for the Migrations
 History table to work correctly. We’ve created a &lt;a href="http://entityframework.codeplex.com/wikipage?title=Migrations%20History%20Table%20Customization"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Multiple Contexts per Database&lt;/strong&gt; removes the previous limitation of one Code First model per database when using Migrations or when Code First automatically created the database for you. We’ve created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Multi-tenant%20Migrations"&gt;
feature specification&lt;/a&gt; for this feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbModelBuilder.HasDefaultSchema&lt;/strong&gt; is a new Code First API that allows the default database schema for a Code First model to be configured in one place. Previously the Code First default schema was hard-coded to &amp;quot;dbo&amp;quot; and the only way to configure
 the schema to which a table belonged was via the ToTable API. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Enums, Spatial and Better Performance on .NET 4.0&lt;/strong&gt; - By moving the core components that used to be in the .NET Framework into the EF NuGet package we are now able to offer enum support, spatial data types and the performance improvements
 from EF5 on .NET 4.0. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbContext can now be created with a DbConnection that is already opened
&lt;/strong&gt;which enables scenarios where it would be helpful if the connection could be open when creating the context (such as sharing a connection between components where you can not guarantee the state of the connection).
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Default transaction isolation level is changed to READ_COMMITTED_SNAPSHOT&lt;/strong&gt; for databases created using Code First, potentially allowing for more scalability and fewer deadlocks.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbContext.Database.UseTransaction and DbContext.Database.BeginTransaction&lt;/strong&gt; are new APIs that enable scenarios where you need to manage your own transactions.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Improved performance of Enumerable.Contains in LINQ queries&lt;/strong&gt;.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Significantly improved warm up time (view generation) &lt;/strong&gt;– especially for large models – as the result of a contribution from
&lt;a href="http://www.codeplex.com/site/users/view/AlirezaHaghshenas"&gt;AlirezaHaghshenas&lt;/a&gt;.&amp;nbsp;
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;DbModelBuilder.Configurations.AddFromAssembly method&lt;/strong&gt;&amp;nbsp; was contributed by
&lt;a href="http://www.codeplex.com/site/users/view/UnaiZorrilla"&gt;UnaiZorrilla&lt;/a&gt;. If you are using configuration classes with the Code First Fluent API, this method allows you to easily add all configuration classes defined in an assembly.&amp;nbsp;
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Custom Migrations Operations&lt;/strong&gt; were enabled by a contribution from
&lt;a href="http://www.codeplex.com/site/users/view/iceclow"&gt;iceclow&lt;/a&gt; and &lt;a href="http://romiller.com/2013/02/27/ef6-writing-your-own-code-first-migration-operations/"&gt;
this blog post&lt;/a&gt; provides an example of using this new feature. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Pluggable Pluralization &amp;amp; Singularization Service &lt;/strong&gt;was contributed by
&lt;a href="http://www.codeplex.com/site/users/view/UnaiZorrilla"&gt;UnaiZorrilla&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Improved Transaction Support &lt;/strong&gt;updates the Entity Framework to provide support for a transaction external to the framework as well as improved ways of creating a transaction within the Framework. See this
&lt;a href="wikipage?title=Improved%20Transaction%20Support"&gt;feature specification&lt;/a&gt; for details.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Improved POCO support&lt;/strong&gt;. Entity and complex types can now be nested inside classes and can have
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Support%20of%20POCO%20entities%20with%20custom%20Equals%20and%20GetHashCode%20implementations"&gt;
custom implementations of Equals or GetHashCode&lt;/a&gt;. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Interception/SQL logging&lt;/strong&gt;. Low-level building blocks for &lt;a href="https://entityframework.codeplex.com/wikipage?title=Interception"&gt;
interception of EF operations&lt;/a&gt; with simple SQL logging built on top.&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Tooling&lt;/h3&gt;
&lt;p&gt;Here are the changes and features we are planning for the EF6 tooling.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://entityframework.codeplex.com/wikipage?title=EF6%20Tooling"&gt;The Basics&lt;/a&gt;
&lt;/strong&gt;covers things that aren’t classified as features but are required to provide a good tooling experience. Topics include branding, installation, supported VS versions, supported EF versions, etc.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Tooling Consolidation&lt;/strong&gt; will combine the EF Power Tools and the EF Designer to provide a single set of tooling with a single wizard for creating new models. We’ve created a
&lt;a href="wikipage?title=Tooling%20Consolidation"&gt;feature specification&lt;/a&gt; for this feature.
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Other Documentation&lt;/h3&gt;
&lt;p&gt;In addition to new features, here are some other topics relevant to EF6.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Updated Provider Model&lt;/strong&gt; - In previous versions of EF some of the core components were a part of the .NET Framework. In EF6 we've moved all these components into our NuGet package, allowing us to develop and deliver more features in a shorter
 time frame. This move required some changes to our provider model. We've created a
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Rebuilding%20EF%20providers%20for%20EF6"&gt;
document&lt;/a&gt; that details the changes required by providers to support EF6, and provided a
&lt;a href="http://msdn.microsoft.com/en-us/data/jj730568"&gt;list of providers&lt;/a&gt; that we are aware of with EF6 support.
&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Upgrading Applications to EF6&lt;/strong&gt; – In some cases you may need to update your EF5 code to work with EF6, see
&lt;a href="http://entityframework.codeplex.com/wikipage?title=Updating%20Applications%20to%20use%20EF6"&gt;
Updating Applications to use EF6&lt;/a&gt;. &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Entity Framework 5&lt;/h1&gt;
&lt;p&gt;The EF5 release was largely completed prior to moving to CodePlex, these documents only include the final set of changes made in EF5.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/wikipage?title=DbContextDefaultCodeGenForDesigner"&gt;Making the Designer use EF5 NuGet Package&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="/wikipage?title=EF5ContentPlan"&gt;Content Plan&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;
&lt;h1&gt;Backlog&lt;/h1&gt;
&lt;p&gt;These documents are for features that have not yet been assigned a release.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Schema%20Information"&gt;Schema Information&lt;/a&gt;
&lt;/li&gt;&lt;li&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Implicit%20boundaries%20in%20LINQ%20to%20Entities%20%28a.k.a.%20client-side%20evaluation%29&amp;version=2"&gt;Implicit boundaries in LINQ to Entities (client-side evaluation)&lt;/a&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Tue, 14 May 2013 16:36:52 GMT</pubDate><guid isPermaLink="false">Updated Wiki: specs 20130514043652P</guid></item><item><title>Updated Wiki: Interception</title><link>https://entityframework.codeplex.com/wikipage?title=Interception&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Interception&lt;/h1&gt;
&lt;h2&gt;Goals&lt;/h2&gt;
&lt;p&gt;The high-level goal for the interception feature is to allow external code to observe and potentially intercept EF operations. The specific goal for EF6 is to allow generated SQL to be logged without using a wrapping provider. A sub-goal to this is to provide
 a simple way for applications to log generated SQL.&lt;/p&gt;
&lt;h2&gt;Interception interfaces&lt;/h2&gt;
&lt;p&gt;The interception code is built around the concept of interception interfaces. These interfaces inherit from IDbInterceptor and define methods that are called when EF performs some action. The intent is to have one interface per type of object being intercepted.
 For example, the IDbCommandInterceptor interface defines methods that are called before EF makes a call to ExecuteNonQuery, ExecuteScalar, ExecuteReader, and related methods. Likewise, the interface defines methods that are called when each of these operations
 completes.&lt;/p&gt;
&lt;p&gt;Currently public interception interfaces exist for DbCommand and DbCommandTree.&lt;/p&gt;
&lt;h2&gt;The interception context&lt;/h2&gt;
&lt;p&gt;Looking at the methods defined on any of the interceptor interfaces it is apparent that every call is given an object of type DbInterceptionContext or some type derived from this such as DbCommandInterceptionContext&amp;lt;&amp;gt;. This object contains contextual
 information about the action that EF is taking. For example, if the action is being taken on behalf of a DbContext, then the DbContext is included in the DbInterceptionContext. Similarly, for commands that are being executed asynchronously, the IsAsync flag
 is set on DbCommandInterceptionContext.&lt;/p&gt;
&lt;p&gt;Collecting this information together into an object keeps the interface methods relatively simple and allows new contextual information to be added in the future with it being a breaking change on the interface.
&lt;/p&gt;
&lt;h3&gt;Caveat &lt;/h3&gt;
&lt;p&gt;It’s worth noting that the interception context is a best effort to provide contextual information. However, in some corner cases some information that you would expect to be there may not be there. This is because EF has code paths that cannot easily be
 changed and do not include information that might be expected. For example, when EF makes a call into a provider, the provider has no knowledge of the DbContext being used. If that provider, outside of EF, decides to call ExecuteNonQuery, then two things might
 happen:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First the provider may just make the call directly, avoiding EF interception completely. (This is a consequence of having interception at the EF level rather than lower in the stack. It would be great if interception were lower in the stack, but this is
 unfortunately outside of the control of the EF team.) &lt;/li&gt;&lt;li&gt;If the provider is aware of EF interception then it can dispatch the ExecuteNonQuery call through EF interceptors. This means that any registered interceptor will be notified and can act appropriately. This is what the SQL Server and SQL Server Compact
 providers do. However, even when a provider does this it is likely that the DbContext being used will not be included in the interception context because the provider has no knowledge of it, and a change to allow this would break the well-defined provider
 APIs.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Luckily this kind of situation is rare and will likely not be an issue for most applications.&lt;/p&gt;
&lt;h2&gt;Result handling&lt;/h2&gt;
&lt;p&gt;The generic DbCommandInterceptionContext&amp;lt;&amp;gt; class contains a property called “Result”. This property is set to null/zero for calls to the …Executing methods and is then set to the result of the operation for the calls to the …Executed methods. This
 means, that in simple scenarios such as logging the result can be be observed and logged.&lt;/p&gt;
&lt;h3&gt;Changing Result before execution&lt;/h3&gt;
&lt;p&gt;If an interceptor sets the Result property before the command has executed (in one of the …Executing methods) then EF will not attempt to actually executed the command. Instead the result set will be used directly by EF.&lt;/p&gt;
&lt;p&gt;An example of how this might be used is the command batching that has traditionally been done with a wrapping provider. The interceptor would store the command for later execution as a batch but would “pretend” to EF that the command had executed as normal.
 Note that it requires more than this to implement batching, but this is an example of how changing the interception result might be used.&lt;/p&gt;
&lt;h3&gt;Changing Result after execution&lt;/h3&gt;
&lt;p&gt;If an interceptor sets the Result property after the command has executed (in one of the …Executed methods) then EF will use the changed result instead of the result that was actually returned from the operation.&lt;/p&gt;
&lt;h2&gt;Registering interceptors&lt;/h2&gt;
&lt;p&gt;Once a class that implements one or more of the interception interfaces has been created it can be registered with EF using the Interception class. For example:&lt;/p&gt;
&lt;pre&gt;Interception.AddInterceptor(new NLogCommandInterceptor());&lt;/pre&gt;
&lt;h2&gt;Dispatching&lt;/h2&gt;
&lt;p&gt;In addition to methods for the registration of interceptors, the Interception class also has a Dispatch method. This method allows code that is not part of EF to dispatch notifications to interceptors on behalf of EF. This is the mechanism mentioned above
 that allows providers to let interceptors know that that a command is being executed outside of the control of EF. It would be rare for an application developer to ever need to use the Dispatch API, but in sure rare cases the calls would look like this:&lt;/p&gt;
&lt;pre&gt;Interception.Dispatch.Command.AsyncNonQuery(
    myCommand, new DbCommandInterceptionContext&amp;lt;int&amp;gt;());&lt;/pre&gt;
&lt;p&gt;This line of code will do the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make sure that IsAsync is set on the interception context &lt;/li&gt;&lt;li&gt;Call NonQueryExecuting on all registered IDbCommandInterceptors &lt;/li&gt;&lt;li&gt;Call ExecuteNonQueryAsync on the given command, unless one of the NonQueryExecuting methods set the Result property as described above
&lt;/li&gt;&lt;li&gt;Setup continuations on the async task such that NonQueryExecuted is called on all registered IDbCommandInterceptors
&lt;/li&gt;&lt;li&gt;Make sure that the result task contains the correct value, which may have been changed by one of the interceptors&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Context Log property&lt;/h2&gt;
&lt;p&gt;The DbContext.Database.Log property can be set to a delegate for any method that takes a string. In particular, it can be used with any TextWriter by setting it to the “Write” method of that TextWriter. All SQL generated by the current context will be logged
 to that writer. &lt;br&gt;
&lt;/p&gt;
&lt;p&gt;When the Log property is set all of the following will be logged:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SQL for all different kinds of commands. For example:
&lt;ul&gt;
&lt;li&gt;Queries, including normal LINQ queries, eSQL queries, and raw queries from methods such as SqlQuery
&lt;/li&gt;&lt;li&gt;Inserts, updates, and deletes generated as part of SaveChanges &lt;/li&gt;&lt;li&gt;Relationship loading queries such as those generated by lazy loading &lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Parameters &lt;/li&gt;&lt;li&gt;Whether or not the command is being executed asynchronously &lt;/li&gt;&lt;li&gt;A timestamp indicating when the command started executing &lt;/li&gt;&lt;li&gt;Whether or not the command completed successfully, failed by throwing an exception, or, for async, was canceled
&lt;/li&gt;&lt;li&gt;Some indication of the result value &lt;/li&gt;&lt;li&gt;The approximate amount of time it took to execute the command&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;DbCommandLogger&lt;/h2&gt;
&lt;p&gt;Under the covers the Database.Log property makes use of a DbCommandLogger object. This object effectively binds a IDbCommandInterceptor implementation to a delegate that accepts strings and a DbContext. This means that interception methods on DbCommandLogger
 are called before and after the execution of commands by EF. These DbCommandLogger methods gather and format log output and send it to the delegate.&lt;/p&gt;
&lt;p&gt;Changing what is logged and how it is formatted can be achieved by creating a new class that derives from DbCommandLogger and then overriding methods as appropriate. The most common methods to override are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;LogCommand – Override this to change how commands are logged before they are executed. By default LogCommand calls LogParameter for each parameter; you may choose to do the same in your override or handle parameters differently instead.
&lt;/li&gt;&lt;li&gt;LogResult – Override this to change how the outcome from executing a command is logged.
&lt;/li&gt;&lt;li&gt;LogParameter – Override this to change the formatting and content of parameter logging.
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Once a new DbCommandLogger class has been created it needs to be registered with EF. This is done using
&lt;a href="http://msdn.microsoft.com/en-us/data/jj680699"&gt;code-based configuration&lt;/a&gt;. In a nutshell this means creating a new class that derives from DbConfiguration in the same assembly as your DbContext class and then calling SetCommandLogger in the constructor
 of this new class. &lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Tue, 14 May 2013 16:32:02 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Interception 20130514043202P</guid></item><item><title>Updated Wiki: Interception</title><link>https://entityframework.codeplex.com/wikipage?title=Interception&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;-&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Mon, 13 May 2013 23:02:52 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Interception 20130513110252P</guid></item><item><title>Updated Wiki: Design Meeting Notes</title><link>https://entityframework.codeplex.com/wikipage?title=Design Meeting Notes&amp;version=61</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Entity Framework Design Meeting Notes&lt;/h1&gt;
&lt;p&gt;The Entity Framework team has a weekly design meeting in which we discuss/recap design and other issues with the codebase. These are the notes from those meetings. The intention is to provide a history of what decisions have been made and why. No attempt
 is made to go back and update notes from older meetings if we later change a decision and decide to do something different.&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20May%209%2c%202013"&gt;May 9, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Interception building blocks &lt;/li&gt;&lt;li&gt;DbContext.Database.Log&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20April%2011%2c%202013"&gt;April 11, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Default providers
&lt;ul&gt;
&lt;li&gt;The default connection factory &lt;/li&gt;&lt;li&gt;Default provider configuration &lt;/li&gt;&lt;li&gt;Additional config file elements &lt;/li&gt;&lt;li&gt;DbProviderServices methods&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;Model-based conventions exploratory testing&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20April%204%2c%202013"&gt;April 4, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Revisit: Using ExecuteSqlCommand without a transaction &lt;/li&gt;&lt;li&gt;Revisit: Extension method class naming &lt;/li&gt;&lt;li&gt;New transient error codes &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20April%202%2c%202013"&gt;April 2, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;API Review: Multiple Contexts per Database &lt;/li&gt;&lt;li&gt;API Review: Configurable Migrations History Table &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%28March%2021%2c%202013"&gt;March 28, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Rename of DbExtensions to IQueryableExtensions &lt;/li&gt;&lt;li&gt;Pattern for customizing migrations history table &lt;/li&gt;&lt;li&gt;Turning off automatic transaction creation &lt;/li&gt;&lt;li&gt;Buffering in EntityClient &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2021%2c%202013"&gt;March 21, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Missing property handling in lightweight conventions &lt;/li&gt;&lt;li&gt;Code First stored procedure mapping &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2019%2c%202013"&gt;March 19, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Connection Resiliency Review &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2018%2c%202013"&gt;March 18, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Async Query &amp;amp; Save API Review &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2014%2c%202013"&gt;March 14, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;File/code-based configuration precedence &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%2013%2c%202013"&gt;March 13, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Custom Code First Conventions &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20March%207%2c%202013"&gt;March 7, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Custom migration operations usability &lt;/li&gt;&lt;li&gt;WrapService naming &lt;/li&gt;&lt;li&gt;Database initializers and shared databases &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%2028%2c%202013"&gt;February 28, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Models with nested types in Code First &lt;/li&gt;&lt;li&gt;Configuration of connection resiliency execution strategy &lt;/li&gt;&lt;li&gt;Behavior of disposed DbContextTransaction &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%2020%2c%202013"&gt;February 20, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Mapping to fields &lt;/li&gt;&lt;li&gt;Removal of unused resources &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%2014%2c%202013"&gt;February 14, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Branching for EF releases &lt;/li&gt;&lt;li&gt;Pull request: extending Migrations &lt;/li&gt;&lt;li&gt;Code First: modification function mapping API (mapping to stored procs) &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20February%207%2c%202013"&gt;February 7, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;DbContext and transactions (continued) &lt;/li&gt;&lt;li&gt;Pull request: extending Migrations &lt;/li&gt;&lt;li&gt;Issues with SQL Server spatial types &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2031%2c%202013"&gt;January 31, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;DbContext and transactions &lt;/li&gt;&lt;li&gt;Code First: modification function mapping (mapping to stored procs) &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2024%2c%202013"&gt;January 24, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Buffering data reader perf &lt;/li&gt;&lt;li&gt;Provider-agnostic testing &lt;/li&gt;&lt;li&gt;Porting old SQL tests &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2017%2c%202013"&gt;January 17, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Metadata API surface &lt;/li&gt;&lt;li&gt;Pluralization service exploratory testing feedback &lt;/li&gt;&lt;li&gt;Metadata unification &lt;/li&gt;&lt;li&gt;Porting existing SQL tests &lt;/li&gt;&lt;li&gt;How should pluralizers be made available? &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20January%2010%2c%202013"&gt;January 10, 2013&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Clustered/non-clustered unique identifier primary keys and SQL Azure &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20December%2013%2c%202012"&gt;December 13, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;Clustered/non-clustered unique identifier primary keys &lt;/li&gt;&lt;li&gt;Potential contribution for pluralization service &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20December%206%2c%202012"&gt;December 6, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Additional ObjectContext and EntityConnection constructors &lt;/li&gt;&lt;li&gt;Default schema changes during initialization &lt;/li&gt;&lt;li&gt;Making EF queries buffer by default &lt;/li&gt;&lt;li&gt;SQL Azure connection resiliency &lt;/li&gt;&lt;li&gt;WET, DAMP, or DRY tests &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%2029%2c%202012"&gt;November 29, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Handling pull requests &lt;/li&gt;&lt;li&gt;Making READ_COMMITTED_SNAPSHOT the default &lt;/li&gt;&lt;li&gt;Database First WinForms data binding &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%2020%2c%202012"&gt;November 20, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Automatic EntityTypeConfiguration discovery &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%2015%2c%202012"&gt;November 15, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;View generation API &lt;/li&gt;&lt;li&gt;Removal of Code Contracts &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20November%208%2c%202012"&gt;November 8, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;Connection resiliency to transient failures &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20October%2025%2c%202012"&gt;October 25, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Change default mapping for DateTime &lt;/li&gt;&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;li&gt;DbConfiguration exploratory testing &lt;/li&gt;&lt;li&gt;Code Contracts discussion &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20October%2011%2c%202012"&gt;October 11, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Lightweight conventions &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20October%204%2c%202012"&gt;October 4, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Global spatial provider &lt;/li&gt;&lt;li&gt;Set-based configuration &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20September%2027%2c%202012"&gt;September 27, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Dependency resolver scoping &lt;/li&gt;&lt;li&gt;Sugar methods for services &lt;/li&gt;&lt;li&gt;Simplified API for common conventions &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20September%2020%2c%202012"&gt;September 20, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;By-convention parameter binding SqlQuery overload &lt;/li&gt;&lt;li&gt;SqlCE relative path connection string UX issues with Migrations &lt;/li&gt;&lt;li&gt;Pluggable Conventions &lt;/li&gt;&lt;li&gt;Polish the conventions API &lt;/li&gt;&lt;li&gt;Breaking change &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20August%2023%2c%202012"&gt;August 23, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Make ObjectContext implement IObjectContextAdapter &lt;/li&gt;&lt;li&gt;Migrations multi-tenancy &lt;/li&gt;&lt;li&gt;Designer versioning &lt;/li&gt;&lt;li&gt;Async protection &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20August%209%2c%202012"&gt;August 9, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Getting schema Information from providers &lt;/li&gt;&lt;li&gt;Using IDbDependencyResolver with existing IoC containers &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20August%202%2c%202012"&gt;August 2, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;CUD Batching &lt;/li&gt;&lt;li&gt;Bulk operations &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20July%2026%2c%202012"&gt;July 26, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Async &lt;/li&gt;&lt;li&gt;One-pagers &lt;/li&gt;&lt;li&gt;Initializer proposal &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20July%2012%2c%202012"&gt;July 12, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Model key caching &lt;/li&gt;&lt;li&gt;Migrations history table schema changes &lt;/li&gt;&lt;li&gt;Async immediate LINQ operators &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20July%205%2c%202012"&gt;July 5, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Refactoring and unit tests &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%2028%2c%202012"&gt;June 28, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Code contracts &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%2021%2c%202012"&gt;June 21, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Code-based configuration &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%2014%2c%202012"&gt;June 14, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Making database connections in the test suite more configurable &lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20June%207%2c%202012"&gt;June 7, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Naming convention for static readonly and const fields &lt;/li&gt;&lt;li&gt;How will we handle breaking changes in EF6? &lt;/li&gt;&lt;li&gt;High-level ideas for using dependency injection with EF and specifics for the provider
&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://entityframework.codeplex.com/wikipage?title=Design%20Meeting%20Notes%20-%20May%2031%2c%202012"&gt;May 31, 2012&lt;/a&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Making EF code more testable &lt;/li&gt;&lt;li&gt;Code duplication in Async &lt;/li&gt;&lt;li&gt;Supporting MVC scaffolding &lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Thu, 09 May 2013 23:29:57 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Design Meeting Notes 20130509112957P</guid></item><item><title>Updated Wiki: Design Meeting Notes - May 9, 2013</title><link>https://entityframework.codeplex.com/wikipage?title=Design Meeting Notes - May 9, 2013&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;Design Meeting Notes - May 9, 2013&lt;/h1&gt;
&lt;h2&gt;Interception building blocks&lt;/h2&gt;
&lt;p&gt;The high-level goal for the interception feature is to allow external code to observe and potentially intercept EF operations. The specific goal for EF6 is to allow generated SQL to be logged without using a wrapping provider. A sub-goal to this is to provide
 a simple way for applications to log generated SQL.&lt;/p&gt;
&lt;p&gt;An overview of the interception feature will be posted to the &lt;a href="https://entityframework.codeplex.com/wikipage?title=specs"&gt;
feature specifications&lt;/a&gt; page. The notes below do not cover the entire feature but rather the points discussed in the design meeting where a change was considered.&lt;/p&gt;
&lt;h3&gt;Interfaces and&amp;nbsp; base classes&lt;/h3&gt;
&lt;p&gt;Currently the plan is to have one interface per type that can be intercepted. So, for example, there is currently an IDbCommandInterceptor and and IDbCommandTreeInterceptor, and in the future there might be an IDbConnectionInterceptor. There is also currently
 a single base type that implements all the public interception interfaces.&lt;/p&gt;
&lt;p&gt;Question: would it be simpler to understand and use if there were a single interface or base type and no interfaces?&lt;/p&gt;
&lt;p&gt;The current separation was done for several reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The design minimizes perf impact for code that needs to intercept for one type but not another. This is because if no interceptor is registered for a given type then EF doesn’t need to make any calls for that type. With a single type EF has no way of knowing
 whether or not a call into the interceptor is required for a given type and so would always call.
&lt;ul&gt;
&lt;li&gt;This raises the question of whether or not we should even provide a base class that implements all the interfaces&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;This helps prevent breaking changes compared to a single interface that we would not be able to add to without it being a breaking change.
&lt;ul&gt;
&lt;li&gt;A single base type would not have this issue, but then no interceptor would be able to have any other base type&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;The interfaces factor related interceptions together into manageable groups&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Decisions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;We will will continue to have interfaces organized like this &lt;/li&gt;&lt;li&gt;We will remove the single base class since it promotes a bad pattern and instead of base classes for any interception interface with many methods&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Other interceptors for EF6&lt;/h3&gt;
&lt;p&gt;Given where we are in the development cycle for EF6 should we consider adding any additional interceptors? In particular, a LINQ expression tree interceptor? Decision: we will do this post EF6.&lt;/p&gt;
&lt;p&gt;Related to this, are there other things that it is worth intercepting on DbCommand?&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Interception of properties doesn’t seem valuable &lt;/li&gt;&lt;li&gt;For other methods:
&lt;ul&gt;
&lt;li&gt;Cancel is never called by EF &lt;/li&gt;&lt;li&gt;CreateParameter is only called when creating parameters for a raw SQL query, and parameters can be examined and manipulated for execution anyway
&lt;/li&gt;&lt;li&gt;Prepare is never called by EF &lt;/li&gt;&lt;li&gt;Dispose for a command doesn’t seem to be valuable to intercept&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Decision: we will not add anything here&lt;/p&gt;
&lt;h3&gt;Filtering design&lt;/h3&gt;
&lt;p&gt;Currently all interceptors are registered globally. This means that interception for a specific DbContext or ObjectContext requires that the interceptor filter for the context. If many contexts in a single app domain are all doing this it
&lt;em&gt;might &lt;/em&gt;have a perf impact. However this is speculative and has not been demonstrated.&lt;/p&gt;
&lt;p&gt;A solution to this could be to include the DbContext and/or ObjectContext in the interceptor registration.&lt;/p&gt;
&lt;p&gt;Decision: we will not do this at this time because:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If it turns out that this really is an issue then we can make this change in the future without it being a breaking change
&lt;/li&gt;&lt;li&gt;A more appropriate pattern for an application that needs to intercept for multiple contexts would be to create a single interceptor to do this
&lt;ul&gt;
&lt;li&gt;This is also more appropriate because it allows efficient filtering by context type, which is often more useful than context instance in these situations&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;If this is never needed, then adding anyway adds to design and API complexity and concept count&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;Collapse everything into the interception context&lt;/h3&gt;
&lt;p&gt;We discussed the idea of collapsing all the methods together on IDbCommandInterceptor and putting all information (DbCommand, result, method being intercepted, etc.) into the context. However, the general feeling was that keeping the object being intercepted
 (DbCommand in this case) as first class was worthwhile, and that collapsing all the methods would make the interface harder to understand and could result in a lot of switch-like code.&lt;/p&gt;
&lt;h3&gt;Result handling and operation overrides&lt;/h3&gt;
&lt;p&gt;Currently the “Executed” interception methods on IDbCommandInterceptor receive a parameter that is the result of executing the operation. These methods then return a value which should normally be this result. However, the interceptor can change the result
 by returning a different value. This can be useful in situations where the provider returns a result such as 0 rows affected but the interceptor knows that really the correct thing happened and wants to return 1 to EF so that EF does not throw a concurrency
 exception.&lt;/p&gt;
&lt;p&gt;The problem with this pattern is that when implementing the interface it is not immediately obvious what the return value from the method is for or what should be returned.&lt;/p&gt;
&lt;p&gt;Related to this is that it would be useful to allow the interceptor to tell EF not to actually perform the operation. For example, consider a wrapping provider that is attempting to batch. One approach for this is to collect all the commands but then hold
 off on executing them immediately. For this to be possible with interception the interceptor needs to be able to tell EF not to execute the commands. Note that this is similar but different from cancelation since EF should continue as though the operation
 was executed using whatever result the interceptor provides.&lt;/p&gt;
&lt;p&gt;Two possible solutions to these problems will be investigated:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Allow the interception context to be mutated such that preventing command execution and result modification can be done by changing the interception context
&lt;/li&gt;&lt;li&gt;Provide another, mutable object that allows result modification and execution cancelation&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;We also considered using ref parameters, but the general feeling was that we should avoid doing this if possible.&lt;/p&gt;
&lt;p&gt;Related to this is that, where possible, we should use a more specific name for the result, such as “rowsAffected”.&lt;/p&gt;
&lt;h2&gt;DbContext.Database.Log&lt;/h2&gt;
&lt;p&gt;Built on top of the interception building blocks is a LINQ to SQL-like “Log” property that can be set to a TextWriter. For example, code like this:&lt;/p&gt;
&lt;pre&gt;using (var context = new BlogContext())
{
    context.Database.Log = Console.Out;

    var blog = context.Blogs.First(b =&amp;gt; b.Title == &amp;quot;One Unicorn&amp;quot;);

    blog.Posts.First().Title = &amp;quot;Green Eggs and Ham&amp;quot;;

    blog.Posts.Add(new Post { Title = &amp;quot;I do not like them!&amp;quot;});

    context.SaveChangesAsync().Wait();
}&lt;/pre&gt;
&lt;p&gt;Will output something like this to the console:&lt;/p&gt;
&lt;pre&gt;SELECT TOP (1)
[Extent1].[Id] AS [Id],
[Extent1].[Title] AS [Title]
FROM [dbo].[Blogs] AS [Extent1]
WHERE (N'One Unicorn' = [Extent1].[Title]) AND ([Extent1].[Title] IS NOT NULL)
-- Completed with result: SqlDataReader

SELECT
[Extent1].[Id] AS [Id],
[Extent1].[Title] AS [Title],
[Extent1].[BlogId] AS [BlogId]
FROM [dbo].[Posts] AS [Extent1]
WHERE [Extent1].[BlogId] = @EntityKeyValue1
-- EntityKeyValue1: Input Nullable Int32 (Size = 0; Precision = 0; Scale = 0) [1]
-- Completed with result: SqlDataReader

update [dbo].[Posts]
set [Title] = @0
where ([Id] = @1)
-- @0: Input Nullable String (Size = -1; Precision = 0; Scale = 0) [Green Eggs and Ham]
-- @1: Input Nullable Int32 (Size = 0; Precision = 0; Scale = 0) [1]
-- Executing asynchronously
-- Completed with result: 1

insert [dbo].[Posts]([Title], [BlogId])
values (@0, @1)
select [Id]
from [dbo].[Posts]
where @@rowcount &amp;gt; 0 and [Id] = scope_identity()
-- @0: Input Nullable String (Size = -1; Precision = 0; Scale = 0) [I do not like them!]
-- @1: Input Nullable Int32 (Size = 0; Precision = 0; Scale = 0) [1]
-- Executing asynchronously
-- Completed with result: SqlDataReader&lt;/pre&gt;
&lt;h3&gt;TextWriter or something else?&lt;/h3&gt;
&lt;p&gt;Should the property be a TextWriter, an event, or delegate? The advantage of TextWriter is that it is really simple to use and is a pattern that was introduced and well-liked in LINQ to SQL. It is worth keeping in mind that this is intended to be a really
 simple way to Log—full power is provided by the interception building blocks. An event could be used, but multi-cast is not required and, for this simple case, neither are event args, sender, etc. Changing the TextWriter to a delegate would not add significantly
 to how hard it is to use especially given that use of lambdas is now a relatively well understood pattern.&lt;/p&gt;
&lt;p&gt;Decision: we will investigate using a delegate instead.&lt;/p&gt;
&lt;h3&gt;Output format&lt;/h3&gt;
&lt;p&gt;The default output format (which is easy to change) was discussed with the following conclusions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Parameters will not be inlined by default, but we will consider creating a DbInliningCommandLogger which can be switched in for those who want executable SQL
&lt;ul&gt;
&lt;li&gt;The reason for this is that parameter information is useful and this is lost using a simple inlining approach
&lt;/li&gt;&lt;li&gt;A simple inlining approach also means that what is logged is not actually what is sent to the database
&lt;/li&gt;&lt;li&gt;Adding code to set and create parameters as comments would be nice, but it would be both quite verbose and require provider changes to do in a provider-agnostic way&lt;/li&gt;&lt;/ul&gt;
&lt;/li&gt;&lt;li&gt;A timestamp will be included before the command is executed and a time-elapsed value will be included after the command has executed
&lt;/li&gt;&lt;li&gt;The parameter value will be moved to the start of the parameter output &lt;/li&gt;&lt;li&gt;Parameter facets (precision, scale, etc.) will only be included if they have non-default values&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Thu, 09 May 2013 23:24:46 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Design Meeting Notes - May 9, 2013 20130509112446P</guid></item><item><title>Updated Wiki: Design Meeting Notes - May 9, 2013</title><link>https://entityframework.codeplex.com/wikipage?title=Design Meeting Notes - May 9, 2013&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
&lt;p&gt;-&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Thu, 09 May 2013 20:10:03 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Design Meeting Notes - May 9, 2013 20130509081003P</guid></item><item><title>New Comment on "Connection Resiliency Spec"</title><link>https://entityframework.codeplex.com/wikipage?title=Connection Resiliency Spec&amp;ANCHOR#C27426</link><description>&amp;#64;GuardianAngel Outer transactions aren&amp;#39;t supported because when an operation that is part of an existing transaction fails then the transaction is rolled back, but the retry strategy isn&amp;#39;t aware of what other operations were executed in that transaction previously so it can&amp;#39;t retry them.&amp;#10;&amp;#10;SupportsExistingTransactions flag is for strategies that don&amp;#39;t ever retry the execution.&amp;#10;&amp;#10;The execution strategy does support transactions started inside the retryable action and actually in most cases we start a new transaction if one didn&amp;#39;t exist.&amp;#10;&amp;#10;If in your scenario you need to execute several operations in a single transaction then instead of globally enabling SqlAzureExecutionStrategy you can create a new instance of it and call Execute passing in the block that starts the transaction and executes the operations.&amp;#10;&amp;#10;Also if this is the case please share your scenario as we are looking for ways to make this experience better.</description><author>AndriySvyryd</author><pubDate>Wed, 08 May 2013 22:32:26 GMT</pubDate><guid isPermaLink="false">New Comment on "Connection Resiliency Spec" 20130508103226P</guid></item><item><title>Updated Wiki: Code-based Configuration</title><link>https://entityframework.codeplex.com/wikipage?title=Code-based Configuration&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;&lt;/h1&gt;
&lt;h1&gt;Code-based Configuration&lt;/h1&gt;
&lt;h2&gt;Background&lt;/h2&gt;
&lt;p&gt;In EF 4.1 most configuration was done through code. In EF 4.3 we added the EntityFramework configuration section to allow configuration via config file.&lt;/p&gt;
&lt;p&gt;Both code-based configuration and file-based configuration are useful. Code-based configuration can make use of IDE and compiler services (strong typing, Intellisense, etc.) and is flexible especially when coupled with dependency injection. File-based configuration
 can allow the same code to run in different environments without re-compiling.&lt;/p&gt;
&lt;p&gt;The main problem with code-based configuration is making sure that the configuration is available to design-time tooling that does not run the application. The tooling must be able to find and execute (or otherwise interpret) the code. This is not possible
 if the configuration is performed by some arbitrary call made at some point during app startup.&lt;/p&gt;
&lt;h3&gt;Goals&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If I don’t know about or care about using code-based configuration, then everything still works
&lt;/li&gt;&lt;li&gt;If I do want to use code-based configuration then it should be simple to do for the main developer scenarios
&lt;/li&gt;&lt;li&gt;If I use it in this simple way, then tooling will also be able to find and use my code-based configuration
&lt;/li&gt;&lt;li&gt;Whatever we add now should also form the basis for adding new configuration going forward
&lt;/li&gt;&lt;li&gt;Less common scenarios (no context, multiple contexts, using Code First building blocks, etc.) may require more work but should still be easy with code-based configuration
&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;The DbConfiguration class&lt;/h2&gt;
&lt;p&gt;EF provides a DbConfiguration base class. To use code-based configuration a developer creates a class derived from DbConfiguration and places it in the same assembly as their DbContext class. Configuration settings are made in the constructor of this class.
 For example:&lt;/p&gt;
&lt;pre&gt;public class MyConfiguration : DbConfiguration
{
    public MyConfiguration()
    {
        SetDefaultConnectionFactory(new LocalDbConnectionFactory(&amp;quot;v11.0&amp;quot;));
        AddDbProviderServices(&amp;quot;My.New.Provider&amp;quot;, new MyProviderServices());
    }
}
&lt;/pre&gt;
&lt;p&gt;This class should be placed in the same assembly as the context class so that EF is able to discover it. However, note that this is configuration for the app-domain, not just for the context. The reason for this is that there are many things that can be
 done with EF that don’t require a context—for example, building a Code First model with DbModelBuilder. This configuration will still be used for such things even though no context is being used.&lt;/p&gt;
&lt;h2&gt;Design-time discoverability&lt;/h2&gt;
&lt;p&gt;As stated above, one of the goals for DbConfiguration is to allow design-time discoverability of configuration for a context. Design-time tools that know the context are also able to discover and create an instance of your derived DbConfiguration class because
 it is located in the same assembly.&lt;/p&gt;
&lt;p&gt;Configuration methods (such as SetDefaultConnectionFactory and AddDbProviderServices) must be called from the constructor because this ensures that all configuration is set when the design-time tools create the DbConfiguration instance. The design-time tools
 have no way of finding or running other code to set configuration.&lt;/p&gt;
&lt;h2&gt;Relationship to dependency resolution&lt;/h2&gt;
&lt;p&gt;The &lt;a href="wikipage?title=EF%20Configuration%20and%20Extensibility"&gt;post on EF dependency resolution&lt;/a&gt; describes the IDbDependencyResolver interface and how it used to set/change EF configuration. Methods like SetDefaultConnectionFactory or AddDbProviderServices
 actually work by adding new dependency resolvers to the chain. These methods are provided as a convenience so that you don’t have to create resolvers. However, if you want greater control over configuration then you can create your own resolvers, possibly
 making use of an IoC container, and use the AddDependencyResolver method instead.
&lt;/p&gt;
&lt;p&gt;Using AddDependencyResolver also allows mutation of configuration while the app is running (by changing what the resolver returns) but doing this can defeat design-time discoverability of the configuration so it should be done with care.&lt;/p&gt;
&lt;h2&gt;Config file precedence&lt;/h2&gt;
&lt;p&gt;Some of the options you can set using code-based configuration &lt;a href="http://msdn.microsoft.com/en-US/data/jj556606"&gt;
can also be set in the application’s config file&lt;/a&gt;. Anything set in the config file always takes precedence over code-based configurations. This allows the config file to be used to change the way an application is configured without requiring that the application
 be re-compiled.&lt;/p&gt;
&lt;h2&gt;Moving DbConfiguration&lt;/h2&gt;
&lt;p&gt;Two options exist to handle cases where it is not possible to place the DbConfiguration class in the same assembly as the context:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can use the config file to specify the DbConfiguration instance to use. To do this, set the codeConfigurationType attribute of the entityFramework section. For example:
&lt;pre&gt;&amp;lt;entityFramework codeConfigurationType=&amp;quot;MyNamespace.MyDbConfiguration, MyAssembly&amp;quot;&amp;gt;
    ...Your EF config...
&amp;lt;/entityFramework&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;You can place a DbConfigurationTypeAttribute on your context class. For example:
&lt;pre&gt;[DbConfigurationType(typeof(MyDbConfiguration))]
public class MyContextContext : DbContext
{
}&lt;/pre&gt;
&lt;br&gt;
&lt;strong&gt;Note:&lt;/strong&gt; We do not support having multiple configuration classes used in the same AppDomain. If you use this attribute to set different configuration classes for two contexts an exception will be thrown.&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Setting DbConfiguration explicitly&lt;/h2&gt;
&lt;p&gt;There are some situations where configuration may be needed before any DbContext type has been used—for example, when using Code First to build a model without a context. There are two ways to allow EF find the configuration in such cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set the DbConfiguration type in the config file, as describe above &lt;/li&gt;&lt;li&gt;Call DbConfiguration.SetConfiguration during application startup&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;When calling DbConfiguration.SetConfiguration if a context is later used then it must still be able to find the same configuration class. This helps prevent unexpected behavior in design-time tools.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoMiller</author><pubDate>Mon, 06 May 2013 20:35:06 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Code-based Configuration 20130506083506P</guid></item><item><title>Updated Wiki: EF Configuration and Extensibility</title><link>https://entityframework.codeplex.com/wikipage?title=EF Configuration and Extensibility&amp;version=5</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;EF Dependency Resolution&lt;/h1&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;EF has historically taken a rather ad-hoc approach to runtime configuration and extensibility. The changes for EF6 described here and
&lt;a href="wikipage?title=Code-based%20Configuration"&gt;in the post covering code-based configuration&lt;/a&gt; are intended to replace this ad-hoc approach with some building blocks that will provide a common mechanism for configuration. In doing so they also allow
 EF to be more easily extended by extracting out services that can then be resolved to different implementations at runtime.&lt;/p&gt;
&lt;h3&gt;This spec describes low level building blocks&lt;/h3&gt;
&lt;p&gt;The components described in this spec are low level building blocks that will only be used in advanced scenarios. Developers wishing to make simple configuration changes from code should use the DbConfiguration class described in the
&lt;a href="wikipage?title=Code-based%20Configuration"&gt;code-based configuration spec&lt;/a&gt;. DbConfiguration provides a simple façade over the components described here.&lt;/p&gt;
&lt;h3&gt;Goals&lt;/h3&gt;
&lt;p&gt;The changes described in these specs address the following goals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Provide a common mechanism and building blocks whereby aspects of existing EF functionality can be factored out or new functionality added in such a way that different implementations can be injected without the core EF code knowing about the specifics
 of these implementations. &lt;/li&gt;&lt;li&gt;Provide a unified mechanism for EF code to access configuration regardless of whether that configuration has been set in code (“code-based”) or in the application’s config file.
&lt;/li&gt;&lt;li&gt;Ensure that configuration can be discovered by design-time tools such that actions such as running the Code First pipeline can be correctly performed by tools.
&lt;/li&gt;&lt;li&gt;Allow, but not require, EF dependencies to be injected using the application developer’s Inversion-of-Control (IoC) container of choice.&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Service Locator pattern&lt;/h2&gt;
&lt;p&gt;The most fundamental underlying building block here is the use of the Service Locator pattern as represented by the IDbDependencyResolver interface:&lt;/p&gt;
&lt;pre&gt;public interface IDbDependencyResolver
{
    object GetService(Type type, object key);
}
&lt;/pre&gt;
&lt;p&gt;At the most basic level, when EF needs an implementation of some interface or base class it will call GetService passing in the interface or base class type and will get back the implementation to use.&lt;/p&gt;
&lt;p&gt;IDbDependencyResolver is similar to the IDependencyResolver interfaces of ASP.NET MVC and Web API.&lt;/p&gt;
&lt;h2&gt;The resolver chain&lt;/h2&gt;
&lt;p&gt;Internally, EF maintains a list of classes that implement this interface and uses the Chain-of-Responsibility pattern to resolve services it needs from this chain. That is, it calls GetService on the first IDbDependencyResolver in the list. If this implementation
 returns null, then it calls GetService on the next. This continues until either a non-null object is returned or the last resolver in the chain is reached. This last resolver is always the “root” resolver which will resolve any service needed by EF with a
 default implementation if none of the other resolvers in the chain resolve the service first.&lt;/p&gt;
&lt;p&gt;In practical terms this means that if you use EF6 out of the box without doing anything then all services needed by EF are resolved by the root resolver to the EF defaults. If you want to change one or more of the defaults then you can add one or more new
 IDependencyResolver implementations to the chain. EF will then resolve the service using the resolver(s) you have added and will no longer use the defaults provided by the root resolver. For any services that your resolver(s) do not handle, the defaults provided
 by the root resolver will still be used.&lt;/p&gt;
&lt;p&gt;For example, to change the default connection factory you can write a DbConfiguration class like so:&lt;/p&gt;
&lt;pre&gt;public class MyAppConfiguration : DbConfiguration
{
    public MyAppConfiguration()
    {
        AddDependencyResolver(new MyDependencyResolver());
    }
}

public class MyDependencyResolver : IDbDependencyResolver
{
    public object GetService(Type type, object key)
    {
        if(type == typeof(IDbConnectionFactory))
        {
            return new MyConnectionFactory();
        }

        return null;
    }
}
&lt;/pre&gt;
&lt;p&gt;More details about DbConfiguration can be found in the &lt;a href="wikipage?title=Code-based%20Configuration"&gt;
post on code-based configuration&lt;/a&gt; (including information about performing configuration without having to worry about resolvers).
&lt;/p&gt;
&lt;p&gt;We also provide a SingletonDependencyResolver implementation of IDbDependencyResolver that returns the given object when GetService is called for the provided generic type and otherwise returns null. This makes it easy to override a specific dependency without
 having to write your own resolver:&lt;/p&gt;
&lt;pre&gt;public class MyAppConfiguration : DbConfiguration
{
    public MyAppConfiguration()
    {
        AddDependencyResolver(new SingletonDependencyResolver&amp;lt;IDbConnectionFactory&amp;gt;&amp;lt;idbconnectionfactory&amp;gt;(new MyConnectionFactory()));
    }
}
&lt;/pre&gt;
&lt;h2&gt;What is the key?&lt;/h2&gt;
&lt;p&gt;This key argument is optionally used to provide information to the resolver about the requested service. For example, the provider invariant name string&amp;nbsp; is passed as a key when when GetService is used to request an EF provider. A GetService implementation
 must then return the provider for the given invariant name.&lt;/p&gt;
&lt;p&gt;The type and semantics of the key object, if any, is documented for each service that may be requested.&lt;/p&gt;
&lt;h2&gt;Isn’t Service Locator an anti-pattern?&lt;/h2&gt;
&lt;p&gt;Some people consider Service Locator to be an anti-pattern. This is for two main reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It can lead to runtime errors if the locator does not know about and hence does not resolve a service, and it is often hard find out which services a locator must resolve.
&lt;/li&gt;&lt;li&gt;No context is provided for the code attempting to resolve the service.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The first issue is addressed in the EF design through the resolver chain and the associated root resolver which is designed to resolve any dependencies not handled by other resolvers. This means that so long as the EF team updates the root resolver whenever
 a new service is added then it doesn’t matter that other resolver implementations don’t know about or handle the new service. Put another way, when you implement IDbDependencyResolver you don’t have to worry about resolving everything, you just resolve the
 services you are interested in.&lt;/p&gt;
&lt;p&gt;The second issue is addressed in two ways. First, the key object provides context about the service being resolved. (The word “context” is used here in its general sense; it does not necessary refer to a DbContext/ObjectContext.) Also, in the design for
 scoping (see below) the key provides context information about the scope of the resolver being created.&lt;/p&gt;
&lt;h2&gt;How do I know what services can resolved?&lt;/h2&gt;
&lt;p&gt;The public services that can be resolved by an IDbDependencyResolver are &lt;a href="http://msdn.microsoft.com/en-us/data/jj680697"&gt;
documented on MSDN&lt;/a&gt;. &lt;/p&gt;
&lt;h2&gt;Generic extension methods&lt;/h2&gt;
&lt;p&gt;Only one GetService method is defined on IDbDependencyResolver to make it easy to implement this interface without lots of duplicate code. However, the most common way of calling the method is to use one of the extension methods:&lt;/p&gt;
&lt;pre&gt;public static T GetService&amp;lt;T&amp;gt;(this IDbDependencyResolver resolver, object key)
public static T GetService&amp;lt;T&amp;gt;(this IDbDependencyResolver resolver)
public static object GetService(this IDbDependencyResolver resolver, Type type)
&lt;/pre&gt;
&lt;p&gt;For example, this:&lt;/p&gt;
&lt;pre&gt;var provider = resolver.GetService&amp;lt;DbProviderServices&amp;gt;(&amp;quot;System.Data.SqlClient&amp;quot;);
&lt;/pre&gt;
&lt;p&gt;Is equivalent to this:&lt;/p&gt;
&lt;pre&gt;var provider = (DbProviderServices)resolver.GetService(typeof(DbProviderServices), &amp;quot;System.Data.SqlClient&amp;quot;);
&lt;/pre&gt;
&lt;h2&gt;What about scopes?&lt;/h2&gt;
&lt;p&gt;Imagine a situation where a DbContext instance depends on a service object that must only live while the context exists and must be disposed when the context is disposed. We currently don’t have an services like this, but it is conceivable that we will in
 the future. We have therefore designed and prototyped a way to handle this and it is described in the
&lt;a href="wikipage?title=Design%20Meeting%20Notes"&gt;EF design meeting notes for September 27, 2012&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Extensibility and open source contributions&lt;/h2&gt;
&lt;p&gt;Let’s say you want to add to or change EF behavior in some way. With the open source model you could submit a pull request, and in a lot of cases we are likely to accept it. However, there may be cases where the change is not appropriate for the core EF
 code for a number of reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It might break existing applications &lt;/li&gt;&lt;li&gt;It might be an uncommon scenario that is useful to you but not the majority &lt;/li&gt;&lt;li&gt;Your implementation might work for you but not be general or robust enough to become a supported part of the product&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;In such situations you may still be able to make the change by creating an interface that is resolved using the mechanisms described above. We are very likely to accept such a changes since it is generally useful to increase the extensibility of the code
 in this way. With such a change in EF you will then be able to add the functionality you need without further changes to the EF code. If you choose you can still make your functionality available to others so that they can benefit from it.&lt;/p&gt;
&lt;h2&gt;Related information&lt;/h2&gt;
&lt;p&gt;The main entry point for EF dependency resolution is the DbConfiguration class which is described in a
&lt;a href="wikipage?title=Code-based%20Configuration"&gt;separate post on code-based configuration&lt;/a&gt;. We intend to also publish a post describing how to use IDbDependencyResolver with an off-the-shelf IoC container.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>RoMiller</author><pubDate>Mon, 06 May 2013 20:20:41 GMT</pubDate><guid isPermaLink="false">Updated Wiki: EF Configuration and Extensibility 20130506082041P</guid></item><item><title>Updated Wiki: EF Configuration and Extensibility</title><link>https://entityframework.codeplex.com/wikipage?title=EF Configuration and Extensibility&amp;version=4</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;EF Dependency Resolution&lt;/h1&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;EF has historically taken a rather ad-hoc approach to runtime configuration and extensibility. The changes for EF6 described here and
&lt;a href="wikipage?title=Code-based%20Configuration"&gt;in the post covering code-based configuration&lt;/a&gt; are intended to replace this ad-hoc approach with some building blocks that will provide a common mechanism for configuration. In doing so they also allow
 EF to be more easily extended by extracting out services that can then be resolved to different implementations at runtime.&lt;/p&gt;
&lt;h3&gt;Goals&lt;/h3&gt;
&lt;p&gt;The changes described in these posts address the following goals:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Provide a common mechanism and building blocks whereby aspects of existing EF functionality can be factored out or new functionality added in such a way that different implementations can be injected without the core EF code knowing about the specifics
 of these implementations. &lt;/li&gt;&lt;li&gt;Provide a unified mechanism for EF code to access configuration regardless of whether that configuration has been set in code (“code-based”) or in the application’s config file.
&lt;/li&gt;&lt;li&gt;Ensure that configuration can be discovered by design-time tools such that actions such as running the Code First pipeline can be correctly performed by tools.
&lt;/li&gt;&lt;li&gt;Allow, but not require, EF dependencies to be injected using the application developer’s Inversion-of-Control (IoC) container of choice.&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Service Locator pattern&lt;/h2&gt;
&lt;p&gt;The most fundamental underlying building block here is the use of the Service Locator pattern as represented by the IDbDependencyResolver interface:&lt;/p&gt;
&lt;pre&gt;public interface IDbDependencyResolver
{
    object GetService(Type type, object key);
}
&lt;/pre&gt;
&lt;p&gt;At the most basic level, when EF needs an implementation of some interface or base class it will call GetService passing in the interface or base class type and will get back the implementation to use.&lt;/p&gt;
&lt;p&gt;IDbDependencyResolver is similar to the IDependencyResolver interfaces of ASP.NET MVC and Web API.&lt;/p&gt;
&lt;h2&gt;The resolver chain&lt;/h2&gt;
&lt;p&gt;Internally, EF maintains a list of classes that implement this interface and uses the Chain-of-Responsibility pattern to resolve services it needs from this chain. That is, it calls GetService on the first IDbDependencyResolver in the list. If this implementation
 returns null, then it calls GetService on the next. This continues until either a non-null object is returned or the last resolver in the chain is reached. This last resolver is always the “root” resolver which will resolve any service needed by EF with a
 default implementation if none of the other resolvers in the chain resolve the service first.&lt;/p&gt;
&lt;p&gt;In practical terms this means that if you use EF6 out of the box without doing anything then all services needed by EF are resolved by the root resolver to the EF defaults. If you want to change one or more of the defaults then you can add one or more new
 IDependencyResolver implementations to the chain. EF will then resolve the service using the resolver(s) you have added and will no longer use the defaults provided by the root resolver. For any services that your resolver(s) do not handle the defaults provided
 by the root resolver will still be used.&lt;/p&gt;
&lt;p&gt;For example, to change the default connection factory you can write a DbConfiguration class like so:&lt;/p&gt;
&lt;pre&gt;public class MyAppConfiguration : DbConfiguration
{
    public MyAppConfiguration()
    {
        AddDependencyResolver(new SingletonDependencyResolver&amp;lt;IDbConnectionFactory&amp;gt;(new MyConnectionFactory()));
    }
}
&lt;/pre&gt;
&lt;p&gt;More details about DbConfiguration can be found in the &lt;a href="wikipage?title=Code-based%20Configuration"&gt;
post on code-based configuration&lt;/a&gt;. The SingletonDependencyResolver is an implementation of IDbDependencyResolver that returns the given object when GetService is called for the provided generic type and otherwise returns null. An example of a simple implementation
 for dependencies without keys (see below) is:&lt;/p&gt;
&lt;pre&gt;public class SingletonDependencyResolver&amp;lt;T&amp;gt; : IDbDependencyResolver
{
    private readonly T _singletonInstance;

    public SingletonDependencyResolver(T singletonInstance)
    {
        _singletonInstance = singletonInstance;
    }

    public object GetService(Type type, object key)
    {
        return type == typeof(T) ? _singletonInstance : null;
    }
}
&lt;/pre&gt;
&lt;h2&gt;What is the key?&lt;/h2&gt;
&lt;p&gt;This key argument is optionally used to provide information to the resolver about the requested service. For example, the provider invariant name string&amp;nbsp; is passed as a key when when GetService is used to request an EF provider. A GetService implementation
 must then return the provider for the given invariant name.&lt;/p&gt;
&lt;p&gt;The type and semantics of the key object, if any, is documented for each service that may be requested.&lt;/p&gt;
&lt;h2&gt;Isn’t Service Locator an anti-pattern?&lt;/h2&gt;
&lt;p&gt;Some people consider Service Locator to be an anti-pattern. This is for two main reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It can lead to runtime errors if the locator does not know about and hence does not resolve a service, and it is often hard find out which services a locator must resolve.
&lt;/li&gt;&lt;li&gt;No context is provided for the code attempting to resolve the service.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The first issue is addressed for in the EF design through the resolver chain and the associated root resolver which is designed to resolve any dependencies not handled by other resolvers. This means that so long as the EF team updates the root resolver whenever
 a new service is added then it doesn’t matter that other resolver implementations don’t know about or handle the new service. Put another way, when you implement IDbDependencyResolver you don’t have to worry about resolving everything, you just resolve the
 services you are interested in.&lt;/p&gt;
&lt;p&gt;The second issue is addressed in two ways. First, the key object provides context about the service being resolved. (The word “context” is used here in its general sense; it does not necessary refer to a DbContext/ObjectContext.) Also, in the design for
 scoping (see below) the key provides context information about the scope of the resolver being created.&lt;/p&gt;
&lt;h2&gt;How do I know what services can resolved?&lt;/h2&gt;
&lt;p&gt;The public services that can be resolved by an IDbDependencyResolver are &lt;a href="http://msdn.microsoft.com/en-us/data/jj680697"&gt;
documented on MSDN&lt;/a&gt;. &lt;/p&gt;
&lt;h2&gt;Generic extension methods&lt;/h2&gt;
&lt;p&gt;Only one GetService method is defined on IDbDependencyResolver to make it easy to implement this interface without lots of duplicate code. However, the most common way of calling the method is to use one of the extension methods:&lt;/p&gt;
&lt;pre&gt;public static T GetService&amp;lt;T&amp;gt;(this IDbDependencyResolver resolver, object key)
public static T GetService&amp;lt;T&amp;gt;(this IDbDependencyResolver resolver)
public static object GetService(this IDbDependencyResolver resolver, Type type)
&lt;/pre&gt;
&lt;p&gt;For example, this:&lt;/p&gt;
&lt;pre&gt;var provider = resolver.GetService&amp;lt;DbProviderServices&amp;gt;(&amp;quot;System.Data.SqlClient&amp;quot;);
&lt;/pre&gt;
&lt;p&gt;Is equivalent to this:&lt;/p&gt;
&lt;pre&gt;var provider = (DbProviderServices)resolver.GetService(typeof(DbProviderServices), &amp;quot;System.Data.SqlClient&amp;quot;);
&lt;/pre&gt;
&lt;h2&gt;What about scopes?&lt;/h2&gt;
&lt;p&gt;Imagine a situation where a DbContext instance depends on a service object that must only live while the context exists and must be disposed when the context is disposed. We currently don’t have an services like this, but it is conceivable that we will in
 the future. We have therefore designed and prototyped a way to handle this and it is described in the
&lt;a href="wikipage?title=Design%20Meeting%20Notes"&gt;EF design meeting notes for September 27, 2012&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Extensibility and open source contributions&lt;/h2&gt;
&lt;p&gt;Let’s say you want to add to or change EF behavior in some way. With the open source model you could submit a pull request, and in a lot of cases we are likely to accept it. However, there may be cases where the change is not appropriate for the core EF
 code for a number of reasons:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It might break existing applications &lt;/li&gt;&lt;li&gt;It might be an uncommon scenario that is useful to you but not the majority &lt;/li&gt;&lt;li&gt;Your implementation might work for you but not be general or robust enough to become a supported part of the product&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;In such situations you may still be able to make the change by creating an interface that is resolved using the mechanisms described above. We are very likely to accept such a changes since it is generally useful to increase the extensibility of the code
 in this way. With such a change in EF you will then be able to add the functionality you need without further changes to the EF code. If you choose you can still make your functionality available to others so that they can benefit from it.&lt;/p&gt;
&lt;h2&gt;Related information&lt;/h2&gt;
&lt;p&gt;The main entry point for EF dependency resolution is the DbConfiguration class which is described in a
&lt;a href="wikipage?title=Code-based%20Configuration"&gt;separate post on code-based configuration&lt;/a&gt;. We intend to also publish a post describing how to use IDbDependencyResolver with an off-the-shelf IoC container.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Wed, 01 May 2013 22:58:00 GMT</pubDate><guid isPermaLink="false">Updated Wiki: EF Configuration and Extensibility 20130501105800P</guid></item><item><title>Updated Wiki: Code-based Configuration</title><link>https://entityframework.codeplex.com/wikipage?title=Code-based Configuration&amp;version=3</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;&lt;/h1&gt;
&lt;h1&gt;Code-based Configuration&lt;/h1&gt;
&lt;h2&gt;Background&lt;/h2&gt;
&lt;p&gt;In EF 4.1 most configuration was done through code. In EF 4.3 we added the EntityFramework configuration section to allow configuration via config file.&lt;/p&gt;
&lt;p&gt;Both code-based configuration and file-based configuration are useful. Code-based configuration can make use of IDE and compiler services (strong typing, Intellisense, etc.) and is flexible especially when coupled with dependency injection. File-based configuration
 can allow the same code to run in different environments without re-compiling.&lt;/p&gt;
&lt;p&gt;The main problem with code-based configuration is making sure that the configuration is available to design-time tooling that does not run the application. The tooling must be able to find and execute (or otherwise interpret) the code. This is not possible
 if the configuration is performed by some arbitrary call made at some point during app startup.&lt;/p&gt;
&lt;h3&gt;Goals&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;If I don’t know about or care about using code-based configuration, then everything still works
&lt;/li&gt;&lt;li&gt;If I do want to use code-based configuration then it should be simple to do for the main developer scenarios
&lt;/li&gt;&lt;li&gt;If I use it in this simple way, then tooling will also be able to find and use my code-based configuration
&lt;/li&gt;&lt;li&gt;Whatever we add now should also form the basis for adding new configuration going forward
&lt;/li&gt;&lt;li&gt;Less common scenarios (no context, multiple contexts, using Code First building blocks, etc.) may require more work but should still be easy with code-based configuration
&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;The DbConfiguration class&lt;/h2&gt;
&lt;p&gt;EF provides a DbConfiguration base class. To use code-based configuration a developer creates a class derived from DbConfiguration and places it in the same assembly as their DbContext class. Configuration settings are made in the constructor of this class.
 For example:&lt;/p&gt;
&lt;pre&gt;public class MyConfiguration : DbConfiguration
{
    public MyConfiguration()
    {
        SetDefaultConnectionFactory(new LocalDbConnectionFactory(&amp;quot;v11.0&amp;quot;));
        AddDbProviderServices(&amp;quot;My.New.Provider&amp;quot;, new MyProviderServices());
    }
}
&lt;/pre&gt;
&lt;p&gt;This class should be placed in the same assembly as the context class so that EF is able to discover it. However, note that this is configuration for the app-domain, not just for the context. The reason for this is that there are many things that can be
 done with EF that don’t require a context—for example, building a Code First most with DbModelBuilder. This configuration will still be used for such things even though no context is being used.&lt;/p&gt;
&lt;h2&gt;Design-time discoverability&lt;/h2&gt;
&lt;p&gt;As stated above, one of the goals for DbConfiguration is to allow design-time discoverability of configuration for a context. Design-time tools that know the context are also able to discover and create an instance of your derived DbConfiguration class because
 it is located in the same assembly.&lt;/p&gt;
&lt;p&gt;Configuration methods (such as SetDefaultConnectionFactory and AddDbProviderServices) must be called from the constructor because this ensures that all configuration is set when the design-time tools create the DbConfiguration instance. The design-time tools
 have no way of finding or running other code to set configuration.&lt;/p&gt;
&lt;h2&gt;Relationship to dependency resolution&lt;/h2&gt;
&lt;p&gt;The &lt;a href="wikipage?title=EF%20Configuration%20and%20Extensibility"&gt;post on EF dependency resolution&lt;/a&gt; describes the IDbDependencyResolver interface and how it used to set/change EF configuration. Methods like SetDefaultConnectionFactory or AddDbProviderServices
 actually work by adding new dependency resolvers to the chain. These methods are provided as a convenience so that you don’t have to create resolvers. However, if you want greater control over configuration then you can create your own resolvers, possibly
 making use of an IoC container, and use the AddDependencyResolver method instead.
&lt;/p&gt;
&lt;p&gt;Using AddDependencyResolver also allows mutation of configuration while the app is running (by changing what the resolver returns) but doing this can defeat design-time discoverability of the configuration so it should be done with care.&lt;/p&gt;
&lt;h2&gt;Config file precedence&lt;/h2&gt;
&lt;p&gt;Some of the options you can set using code-based configuration &lt;a href="http://msdn.microsoft.com/en-US/data/jj556606"&gt;
can also be set in the application’s config file&lt;/a&gt;. Anything set in the config file always takes precedence over code-based configurations. This allows the config file to be used to change the way an application is configured without requiring that the application
 be re-compiled.&lt;/p&gt;
&lt;h2&gt;Moving DbConfiguration&lt;/h2&gt;
&lt;p&gt;Two options exist to handle cases where it is not possible to place the DbConfiguration class in the same assembly as the context:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can use the config file to specify the DbConfiguration instance to use. To do this, set the codeConfigurationType attribute of the entityFramework section. For example:
&lt;pre&gt;&amp;lt;entityFramework codeConfigurationType=&amp;quot;MyNamespace.MyDbConfiguration, MyAssembly&amp;quot;&amp;gt;
    ...Your EF config...
&amp;lt;/entityFramework&amp;gt;
&lt;/pre&gt;
&lt;/li&gt;&lt;li&gt;You can place a DbConfigurationTypeAttribute on your context class. For example:
&lt;pre&gt;[DbConfigurationType(typeof(MyDbConfiguration))]
public class MyContextContext : DbContext
{
}
&lt;/pre&gt;
&lt;/li&gt;&lt;/ul&gt;
&lt;h2&gt;Setting DbConfiguration explicitly&lt;/h2&gt;
&lt;p&gt;There are some situations where configuration may be needed before any DbContext type has been used—for example, when using Code First to build a model without a context. There are two ways to allow EF find the configuration in such cases:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set the DbConfiguration type in the config file, as describe above &lt;/li&gt;&lt;li&gt;Call DbConfiguration.SetConfiguration during application startup&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;When calling DbConfiguration.SetConfiguration if a context is later used then it must still be able to find the same configuration class. This helps prevent unexpected behavior in design-time tools.&lt;/p&gt;
&lt;/div&gt;&lt;div class="ClearBoth"&gt;&lt;/div&gt;</description><author>ajcvickers</author><pubDate>Wed, 01 May 2013 22:40:00 GMT</pubDate><guid isPermaLink="false">Updated Wiki: Code-based Configuration 20130501104000P</guid></item></channel></rss>