How software engineers make cookies, or a true story about over thinking everything… Continue reading
Since EF 4.3 it has been possible to use CreateIndex and DropIndex in Code First Migrations to create and drop indexes. However this had to be done manually by editing the migration because the index was not included anywhere in the Code First model. Now with EF 6.1 it is possible to add index specifications to the model such that creating and dropping indexes can be handled automatically by Migrations. Continue reading
I already blogged about SQL logging in EF6. Part 3 of that series shows how to use EF with a logging framework such as NLog. If you do this then you can easily switch logging on and off using NLog or equivalent without any changes to the app. This is the approach I would use if I wanted to log SQL from EF. But what if logging was not considered at all when the app was created? Now with EF 6.1 you can switch logging on for any app without access to the source or recompiling. Continue reading
On the EF team we frequently get questions along the lines of, “when will the next version of EF be released?” This is an entirely reasonable question to ask and it is frustrating to me personally that I cannot answer such questions. But of course this is nothing compared to the frustration felt by those of you who never get an answer. So why is it this way?
Update: Visual Studio 2013 has been announced for “this year” by Brian Harry. If you read the rest of this post you will realized that this means EF6 RTM will be also released “this year”. Continue reading
Entity Framework contains two different methods both called Seed that do similar things but behave slightly differently. The first was introduced in EF 4.1 and works with database initializers. The second was introduced in EF 4.3 as part of Code First Migrations. This post describes how these two methods are used, when they are called, and how they differ from each other. Continue reading
Posted in Code First, Code First Migrations, Database Initializers, DbContext API, Entity Framework
Tagged Code First, Code First Migrations, Database Initializers, DbContext, EF4.1, EF4.3, EF5, EF6, Entity Framework
In parts 1 and 2 of this series we looked at how to use DbContext.Database.Log to log the SQL generated by EF. But this code is actually a relatively thin façade over some low-level building blocks for interception in general and, in this case, DbCommand interception in particular. Continue reading
In part 1 we saw how DbContext.Database.Log can be used to easily log SQL to the console or some other TextWriter. This post covers how the context and formatting of the output can be changed.