Some DDD+EF Resources


Could not fit this into a tweet in response to a request.

Here are some resources for how EF can be a partner to a Domain Driven Design world:

Update June 2015:

Microsoft Ignite, Chicago May 2015
Domain-Driven Design for the Database Driven Mind (90 minute presentation video on Channel 9)

Update: October 2014:

MSDN Mag Oct 2014 Issue:
Data Points: A Pattern for Sharing Data Across Domain-Driven Design Bounded Contexts
Julie Lerman explores a way to mirror data as one scenario for sharing data across DDD bounded contexts.

MSDN Mag Dec 2014 Issue:
Data Points: A Pattern for Sharing Data Across Domain-Driven Design Bounded Contexts : Part 2
(will provide link when available)

Video: Oredev, Fall 2013 (by me)

Video: TechEd North America, May 2014 (Vaughn Vernon)
How You Can Implement Aggregates and Domain Entities Effectively in Domain Models, with .NET

Article Series:
MSDN Magazine Data Points Column (by me) Aug, Sept & Oct 2013
Coding for Domain-Driven Design: Tips for Data-Focused Devs, Part 1
Coding for Domain-Driven Design: Tips for Data-Focused Devs, Part 2
Coding for Domain-Driven Design: Tips for Data-Focused Devs, Part 3

Domain modeling with Entity Framework Scorecard (Jimmy Bogard)

Bonus for NHibernate Converts:
And for those who are looking for this by way of moving from DDD + NH, Jimmy Bogard did a great post (with pointers to related posts) on Migrating from NHibernate to EF.

ICYMI, My General Advice re DDD, EF & Domain Models with or without Data Models


I wrote this in a Github issue thread about EFCore & lack of current support for complex types (which support DDD Value Objects .. to a degree) this morning and someone said I should share it so here it is:

I love value objects. I’m just not considering efcore for any serious work yet so I am not going to stress out about not using them. I find myself designing my domain with them out of habit then having to undo. And if you are set on efcore, then +++ to @jnm2 ‘s point. I map from domain to EF’s data model (the in-memory model that EF infers at runtime) using EF’s mapping when it’s easy and I don’t have to make annoying (or worse) concessions. Otherwise it is time for a mapper between domain and data model defined by separate classes + EF DBContext. So EF mapping layer is my default mapper when using EF. But sometimes it is just not sufficient and I go to (or recommend) the effort of building a separate data model. Your choice. Pick your battles.

Another point is that Jimmy Bogard doesn’t even think the ef6 complex types do enough to map types that you’ve defined as value objects. So he’s been either just using one to one or going the extra mapper route depending on the situation. Gogglebing Jimmy Bogard, something like “what’s missing in ef6 for DDD” to read more. And then there’s that collection conundrum, too as well as the problem of mapping private fields. So if you are okay without those in EF6, maybe support for value objects isn’t such a huge deal except for the problem of it being “taken away” temporarily.

My ref to Jimmy Bogard was for his Domain modeling with Entity Framework scorecard post.

I’m sharing because of the following reply from Joseph Musser on this thread:

I would love to have had (and still would love) an article that thoroughly addresses that question: weighing the pros and cons of staying within EF modeling constraints or using a data model and mapping yourself. When to consider making the switch. And what that means for creating a rich, disciplined model that doesn’t become anemic. I feel like I’ve wasted a lot of time not having a fundamental understanding of this from the beginning.

Specifying Global TypeScript server path in Visual Studio Code in OSX


Since I’m really new to working on a mac, the instructions on the VSCode blog post ( for enabling Salsa for TypeScript in VSCode was just not enough for me. This is the instruction:

You then have to tell VS Code the install location using the typescript.tsdk setting. Set typescript.tsdk to the path of thelib folder containing the tsserver.js file of the installed TypeScript module.

I had done a global install. And since hidden files and the usr/ folder are also a mystery to me, it took me a while to figure out that this is how to specify that in the settings.json file in VSCode.

“typescript.tsdk”: “usr/local/lib/node_modules/typescript/bin/tsserver”

I hope someone can save some time by finding this blog post.

salsa in vscode

OSX, ASPNetCore, EFCore and CoreCLI, oh my!


After moving some RC1 test projects from windows over to my MacBook, it was time to start from scratch in OS X to see what that experience was like. Installing all the right pieces. I’d been using Visual Studio Code already on windows for nodes programming, but doing that for an ASP.NET 5 project is a little harder since the debugging for that isn’t implemented yet. At the same time I’m still getting used to navigating my way around a Mac … keystrokes, bash commands etc.

But I did get a small sample worked out and even used PostgreSQL to do the job.

That (remember, RC1) little test is on github here:

But RC2 is a different beast!

Addendum because so many have asked: I am using the nightly builds of RC2. It is not out yet!

DNX is transitioning to CoreCLI with new underlying APIs. And there was that name change. ASPNET 5 became ASP.NET Core and EF7 became EF Core. The package and namespaces have changed.

And in the meantime, EF7/EFCore is still going through changes with RC2. To me the most significant is the work the team has been doing to help with disconnected graphs. You can read the latest (and I think final) state of how EF will handle disconnected graphs here on github.

I tried a few paths to starting a new project to try out RC2. Here’s some twitter evidence:

I had watched the video of David Fowler & Damien Edward’s talk about Core CLI from NDC London and David did the demos on a mac.

But it took a tweet from Tony Sneed to remind me that I could get David’s demos from github:

Indeed, that was the best starting point. I cloned that repository onto my MacBook and made sure I could run all three projects.

Now I’m working on building out the HelloMVC project by adding in the model, dbcontext, controllers and other relevant bits from my RC1.

At the moment (as of Feb 1 2016), the dotnet ef migrations commands aren’t working but Brice Lambson is working hard on it and says that should be pushed up this week. (Watch this github issue.)

And it might be a while before the Postgres provider gets updated to work with the new namespaces and package dependencies  but we do have the Microsoft.EntityFrameworkCore.Sqlite provider that will work on OS X although there seem to be a lot of problems at the moment with that on Linux. But I’ll be trying that out anyway.

Travel & Conference Schedule Feb – May


I didn’t travel much last year so am making up for it this spring and summer. Here is where I will be and what I’ll be talking about in the near future.

Feb 15 Vermont.NET User Group/VTCoders
(My home base!)
Aurelia & Node.js: Fitting the pieces together Burlington, VT
Feb 18 DotNetMiami 7 Reasons to Use EF7, 6 Reasons to Stay with EF6 Miami, FL area
Feb 20 South Florida Code Camp 7 Reasons to Use EF7, 6 Reasons to Stay with EF6

Aurelia & Node.js: Fitting the pieces together

Ft. Lauderdale, FL
Mar 10 WROC# Entity Framework on OSX:
  Microsoft Data Access Gone Wild!
Wroclaw, Poland
Mar 28-31 QConSP Entity Framework on OSX:
   Microsoft Data Access Gone Wild!
[Workshop] Thinking in DDD:
  Improve your software without being a guru
Sao Paulo, Brazil
April 6-8 AATC2016
(Agile Alliance Tech Conf)
Introducing Your Team to Modern Software Practices Raleigh, NC
May 3-4 Techorama EF on OSX: Microsoft Data Access Gone Wild!
Introducing Your Team to Modern Software Practices
Mechelen, Belgium
July 4-6 DevTeach Aurelia & Node.js: Fitting the pieces together
(aka JavaScript Noob’s Look at an Aurelia Front End, Node Back End Web Site)

Entity Framework on OSX:
    Microsoft Data Access Gone Wild!

Montreal, Quebec

EF7 is now EF Core 1.0, Package and namespaces change too


The big news last week was that the ASP.NET 5 & EF7 stacks were renamed in an attempt to alleviate the confusion around the naming of everything under the ASP.NET 5 umbrella.

ASP.NET 5 is now ASP.NET Core 1.0

EF7 is now EF Core 1.0

The naming has been a topic of debate since each of these were introduced by Microsoft and throughout their development. The teams finally accepted that the myriad questions and complicated answers about the naming in the ASP.NET 5 stack was enough of a red flag to change the names. While it is a huge relief to many, the timing is problem for people who have invested in 5 already because the name is not just a brand but it will affect packages as well. As per the announcement on github

  1. The Microsoft.AspNet.* packages and namespaces are changing to Microsoft.AspNetCore.*.
  2. The EntityFramework.* packages and namespaces are changing to Microsoft.EntityFrameworkCore.*.
  3. The version numbers of all of the above are being reset to 1.0.0-*.

Changing the namespaces this late in the game is going to be painful for devs/companies who have already been building apps and tooling on ASP.NET 5 &/or EF7. We are already on RC1 which was released in November with a go live license. Rick Strahl has a great [balanced] post talking about this.

Other than this, both ASP.NET Core & EF Core will move forward as planned. RC2 is supposed to be out sometime in February and they remain committed to the initial RTM at the end of March.

Here are the new namespace names for EF Core for RC2, as per

In EF7 In EF Core
EntityFramework.Core Microsoft.EntityFrameworkCore
EntityFramework.Commands Microsoft.EntityFrameworkCore.Commands
EntityFramework.MicrosoftSqlServer Microsoft.EntityFrameworkCore.SqlServer
EntityFramework.MicrosoftSqlServer.Design Microsoft.EntityFrameworkCore.SqlServer.Design
EntityFramework.Relational Microsoft.EntityFrameworkCore.Relational
EntityFramework.Relational.Design Microsoft.EntityFrameworkCore.Relational.Design
EntityFramework.InMemory Microsoft.EntityFrameworkCore.InMemory
EntityFramework.Sqlite Microsoft.EntityFrameworkCore.Sqlite
EntityFramework.Sqlite.Design Microsoft.EntityFrameworkCore.Sqlite.Design

If you are curious about what’s in EF Core, check out my EF7 Course on Pluralsight which I created during the Beta 4 …then read my recent post, EF7 Updates and Changes on Pluralsight’s blog which takes you from there to the current RC1.

Visual Studio 2015 Update 1: EXE Install vs Control Panel Install


tldr; my recommendation is to just do the update from control panel, not from the VS2015.1.exe

If you follow me on twitter (@julielerman) you may have caught one of my tantrum driven tweets yesterday about problems with IISExpress after I updated Visual Studio 2015 to Update 1.

I finally resolved my problems but not after a lot of whining, chocolate and avoidance measures (including a Doctor Who Season 9 episode).

I had been avoiding the update since a number of folks had been complaining about it taking hours and hours but I finally decided to bite the bullet.

I initially updated by downloading the vs2015.1.exe via VS2015 Extensions and running that. It didn’t take too long (20 minutes maybe) but in the end reported that Microsoft .NET Framework 4.6.1 RC Developer Pack had not been installed. This is a known issue. I restarted and installed that and was rewarded with “Successfully installed”.

Then I opened up an ASP.NET MVC5 (*not* the new app I’d been working on and tried to run it and so began my problems with IISExpress. Visual Studio could not launch it. I won’t go into the many and various things I tried for the next few hours with hints from friends on twitter and many stackoverflow and blog posts. I even uninstalled and reinstalled IIS 10.0 Express a few times and tried various security/permission tweaks as well. I had offers from friends to jump on skype to help and finally took one of those up – thanks Gregor Suttie (@gsuttie) – though we still made no headway.

There was another strange problem that is noteworthy. Although Visual Studio’s Help/About window showed that I had the version # for Update 1 installed, the Extensions dialog continued to show Update 1 as an available update to Visual Studio. Something wasn’t in sync.

Others on twitter reported issues with Update 1, even Barry Dorrans (@blowdart) who is a security expert on the ASP.NET team and Jeff Prosise (@jprosise), a renowned .NET super duper uber expert.











I decided it was time to just uninstall and reinstall VS2015 – cleaner than a repair in my mind. Though I hadn’t yet determined if I would apply the Update 1 again.

I opened up Control Panel/Programs, found Visual Studio Enterprise in the list and selected it. I immediately got a notification that the setup program for Visual Studio had changed significatnly and did I want to update that before making any changes to the installation.


Even though my plan had been to uninstall, I decided to take that path. The update took some time … I think over 1/2 hour.

When it was done, Update 1 was one of the options listed when I chose to Modify.


FWIW, after performing the update, you can’t uncheck that option.



I selected the Update 1 and didn’t touch anything else and let ‘er rip (e.g. clicked the Update button).

It took some time to update and it was nice to see that it also brought in the latest version of the EF Designer (6.1.3) for me. “some time” ….I didn’t keep track at all …went upstairs for dinner.

When all was said and done, all of the problems I had seen via the exe install were gone. Update 1 was in place. Extensions no longer prompted me to install the update. I could debug in IISExpress again. All of my other extensions were still in place. (Update: nuget was gone, so I had to reinstall that.)

Oh and I had the new icon which many had fought so hard for:


So my recommendation is to just do the update from control panel, not from the VS2015.1.exe!!

EF7 RC1 Notes–An Update to my Pluralsight “Planning Ahead for Entity Framework 7” course


In early 2015, I published a course titled “Looking Ahead to Entity Framework 7”. This was created using an early version of the work that the EF team was doing on the total refresh of Entity Framework.

That version was referred to as Beta 4 although was still so malleable that the EF team even referred to it as an alpha. In fact, the only reason it had the tag “beta 4” was to align with the set of Nuget packages that were being released for ASP.NET 5 as it was developing. An important goal with EF7 was that it needs to work with ASP.NET 5, so the EF team needed to release their stable pre-releases on (e.g. in sync with ASP.NET 5. The nightly builds, which are available on are a different story and are pushed frequently by the EF team whenever they are ready to do so.

Since the course was released some technical things have changed and even the release plans have changed. Rather than updating the course each time, potentially introducing more things that will change by RTM, I will wait until EF7 is closer to RTM and use that to create a course about the release.

In the meantime, I think it is important to have some awareness of the current landscape so that combined with watching Looking Ahead to Entity Framework 7, you can plan ahead effectively. My recommendation is to at least peruse this blog post before watching the course and then come back and read it more carefully when it will make more sense.

In this post I will address each of the 6 modules of the beta 4 course and alert you to what has changed and what to expect.

Module 1: Achieving Microsoft’s Goals for EF with EF7

The overarching goals for EF7 have not changed. Microsoft is wholly committed to a completely new code base for EF7 using modern software practices. The New Devices New Data Stores goal is still correct and as you learned (or will learn when you watch the course), the proof of concept work around NoSQL and Redis is still set aside.

While discussing where you can use EF7, I showed a slide that talked about various frameworks.


This shifts a bit since the initial RTM of EF7 will now support UWP (Universal Windows Platform) which targets Windows 10 devices including phones and tablets. Along with this change, the SQLite provider that had been set aside, is now part of the initial RTM. In the course, I explained that the Windows Phone 8 & Windows Store support is also set aside for a later release after the initial RTM. That is still true.

Here is an updated version of that slide I created for a recent conference:


Another change to the first module is related to the timeline. I explained how EF7 was going to focus on being able to release alongside of ASP.NET5 which meant setting aside of of the goals that they wanted to achieve. I also explained that when ASP.NET 5 was released, we would get a release of EF7 that would be still called a pre-release, not an RTM. Here is the slide I used while discussing this timeline.


These plans have changed somewhat. While the initial ASP.NET focused release of EF7 is still going to be a subset of all that the team wants to implement in EF7, it is now going to be a full release, an RTM, not a pre-release. So at the same time ASP.NET 5 is released, EF 7.0.0 will be released.

Here is what has not changed however:

· EF 7.0.0 will still be an “abbreviated” version.

· The features that the team is focusing on are those which align well with web applications. A good example of this is that they are working on improving the experience with disconnected entities and have set aside some magical relationship features such as explicit and lazy loading.

· EF 7.0.0 will not become the “official” version of Entity Framework.

· EF6 will continue to be the official version.

· EF6 will continue to be what’s delivered when you install entityframework via Nuget.

· Your apps that use EF6 will not automatically update to EF7!

· When installing the packages via Nuget, you will not need to use “-pre” to distinguish between EF6 and EF7.
EF6 will continue to install using install-package entityframework. There is no plain old entityframework package for EF7. You would begin with your desired provider (e.g. entityframework.inmemory) and that will pull in all dependences e.g. entityframework.core and more. Since this is a full RTM for EF7, you will no longer need to use the –pre.

Also, we now have a pretty well-delineated roadmap from the EF team on their github wiki. Most importantly is that the RC1 (Release Candidate with Go-Live) version of EF7 (as well as ASP.NET5) was released in November 2015. According to the ASP.NET 5 roadmap, there will be an RC2 in February with the RTM targeted to the first quarter of 2016. There will be a big change Another notable point on the ASP.NET 5 website is the lack of Visual Basic support until possible Q3 of 2016.

According to the roadmap, EF7 will become the official version at some point in the future when the team feels that they have a critical mass of important ORM features implemented.

Here is an updated version of the above timeline slide which I used in my recent conference talk:


Module 2: Targeting EF7 Initial and Future Releases

The list of things collected in what will be in the initial release has not changed significantly except that now, as mentioned above, EF7 will also support the UWP apps.

Re VS *& .NET versions. While ASP.NET 5 can run on the DNX environment, it can also be run on a full .NET Framework environment. In the course, it says this will be possible with 4.5 and beyond. Now it will be for .NET 4.5.1 and beyond. I don’t believe that the future releases will revert back to supporting 4.5 at all.

Installing: As mentioned above, the latest stable release is available on (Today that is RC1). The nightly builds are available via the myget package source ( The team is currently working on RC1 in the nightly builds. Sometime this month (November 2015) a stable version of RC1 will become available on and that will be what you get with the “-pre” tag.

In Beta4 there was still an EF7 package named EntityFramework. That no longer exists, enabling us to use that package name to specifically target EF6. For EF7, it’s easiest to begin with the provider that you want and then this will pull down all of the relevant dependencies. So for example
install-package entityframework.sqlite” will pull down that package, the relational package (which includes migration support), the core package and others.

Don’t forget that the migrations commands are in a separate package: EntityFramework.Commands, which you need to explicitly install if you want to perform migrations in nuget or the DNX environment.

This is important: the “K Runtime” is now the “DNX runtime”.

All of the commands that you run start with dnx now, not k.

For example:

dnx ef migrations add

Playing with the proof of concept features The support for the stripped down framework used for Windows Phone 8 and Window Store apps was set aside and is still in that state. Those DLLs are not handily available. The tricks I used in the course to access those assemblies may or may not work still. I haven’t tested. Remember though that the SQLite assembly is now part of EF7 so that’s easy to get! And if you can target Windows 10 phone & tablet apps with EF7.

Module 3: Querying and Updating with EF7 (Disconnected Graphs change!)

Most of the changes from that evolved since I created this course with beta4 are around syntax. Even in the course you could see that at first the team was renaming methods to better suit how they wish they had been named. For example, rather than have DbSet.Add and DbSet.AddRange, they modified add to just take an overload that accepted a range. But just before I pushed the course live, they changed the methods back to Add taking a single object and AddRange specifically for a range. The reason for this is to lessen the blow of changes to the API. This could be something that would be backwards compatible with EF6. There have been a number of changes like this as EF7 has evolved where some of the syntax was reverted to better align with EF6. Even behavior has shifted. Add is another example. EF6 and earlier had a pattern of [almost] always affecting full graphs when you pushed a root of a graph into the context with Add/attach/Delete or using the Entry().State property. And the effect were inconsistent. They experimented with completely separating behavior by making Add (etc) and Entry.State ONLY affect the root and then giving us a new method ChangeTracker.AddGraph soley for working with graphs. Since beta4, the team has narrowed in on a pattern that will be the final say on this matter. Here it is:

DbSet.Add, AddRange, Attach, AttachRange, Update, UpdateRange: These methods now take a new 2nd parameter which is an enum,GraphBehavior.

GraphBehavior values are IncludeDependents and SingleObject.

The default for the above methods is GraphBehavior.IncludeDependents which means that a just using it in a familiar way, e.g.:


will result in *almost* familiar behavior. THe catch (which is a good improvement, in my opinion)is that the default behavior, IncludeDependents, is literally for dependent objects. it is not going to include All Related Objects. The distinction is important. Objects in a relationship are either principal (aka “parent”, or dependent (aka “child”). In the database these are easily distinguishable because the dependent is the one that has the foreign key back to the principal.

Consider the following Principal to Dependent relationships:

Order –> Line Items



It makes sense to create a new order, add some new line items to it and then add that order graph by calling context.Orders.Add(order). In this case, all of the dependent line items will be included in the operation, i.e. marked as Added as well.

It makes sense to add an address record to a person and then add that person to the context. context.People.Add(person). Again, the dependent address  would be marked as added. The category with it’s dependent products also is logical.

If for some reason you created a new line Address instance then identified it’s Person by setting someAddress.Person=somePerson, and then added that address via context.Addresses.Add(someAddress), EF7 will not mark the parent/principal object (somePerson) as Added. Adding a new address does not necessarily mean you are adding the new person so EF won’t make that presumption. I also am a fan of building my model with aggregate roots that are in charge of the behavior of their related data. So I wouldn’t allow my tyeps to be used in such a way that the user of my API could create an address and randomly add it anyway. So this behavior aligns with coding patterns that I recommend.

It also solves another problem I see a lot where devs use object instances to specify reference properties. I always recommend using foreign key properties for this but I know that so many programmers have the following problem.

Imagine this scenario:

The form for building or editing the order has a place to enter the a new  shipping address for a customer. One of those fields is a dropdown for “region” (in my case, in the U.S. that would be a state like Vermont or Utah). I query for a list of region objects and populate a dropdown list.


I select Vermont and then my code does something like this: theOrder.theAddress.Region=(region)List.SelectedItem. I add the order with context.Orders.Add(theOrder) and call SaveChanges.

The next person who goes to add an address sees this:


Two Vermonts! That’s because in EF6 (and earlier) everything in the graph is marked added and the EF inserts the Vermont object into the database even though it was already there.

In this case, the model sees REGION as the principal and ADDRESS as the dependent because ADDRESS has a foreign key back to REGION. EF7 will not include the principal. Only the address will get inserted and the crops are saved!

Add, Attach & Update: Root Only

So, the default for Add, AddRange, Update, UpdateRange, Attach and AttachRange is to include dependents. Using the parameter, you can specify the SingleObject enum and then only the root entity of the graph will be affected by the method.


In RC1 this is the same as I explained in the course: if you specify an entity that is in a graph, only that entity will be affected by setting the state. Any other objects that are part of the graph will be untouched.

ChangeTracker.AddGraph has changed to ChangeTracker.TrackGraph

The signature is the same, you pass in the graph and a lambda function. The lambda can express the state that you want the graph to use.

context.ChangeTracker.TrackGraph(someEntityWithRelatedObjectsAttached,          e => e.Entry.State = EntityState.Added);

EF will walk the graph and apply that function to everything it discovers in the graph, skipping objects that are already being tracked (and their related objects).    A cool feature of this method (same as when it was called AddGraph) is that that function does not have to express state. It can be any function you want.

The DbSet.Find method
This was set aside for post-RTM, but the team is reconsidering and may get it in for RTM. More here:

Module 4: Using and Migrating Relational Databases

In this module I talked about some differences between how migrations worked relative to how we are used to them working in EF 4.3 to EF6. I also showed how migrations work in the k runtime commands if you are using ASP.NET 5 and not able to use the familiar PowerShell commands. I also explained that the magic behavior of the DbInitializers as well as automatic migrations will not be part of EF7.

Not a lot has changed since the beta4 release that the course is based on. The team has streamlined the commands a bit more. They had introduced a new “apply-migration” command to replace update-database, but apply-migration is gone and you will just use the familiar update-database command.

On the ASP.NET side, the commands are now dnx commands, not k commands. So the current way to express adding a migration, therefore is:

dnx ef migrations add myAwesomeMigration

Not much else has changed from what is explained in Module 4.

There’s a nice chart in the July 23rd EF design meeting notes that shows the changes.

Not really migrating, but the commands now support reverse engineering with a scaffold command that has a bunch of helpful parameters to customize how the code is generated.

Module 5: EF7 Futures

This module covers things that the team was exploring but set aside to focus on the ASP.NET 5 aligned release. Those were non-relational stores (with Redis and Azure Table Storage as their proof of concept) and allowing EF to run on the trimmed down version of .NET that is used for Windows 8 phone and tablet (aka “windows store”) apps which also relied on the new SQLite provider. Since the assemblies were still accessible, I showed a demo of a Windows Phone and Windows Store app that used SQLite as well as one that used Azure Table Storage.

The Azure Table Storage and Redis providers are still set aside, as I explained in this module.

And while it is still true that EF7 will not initially support this Windows 8 Phone and Store apps when it is released, the team did bring SQLite back into the fold for EF 7.0.0. The reason that SQLite was re-ignited is because, as I mentioned above, EF7 is now able to run on UWP (Universal Windows Platform) the Windows 10 platform that lets us create cross-device apps that will also run on phones and tablets. Those will benefit from using SQLite. In fact, I was able to rebuild the Cookie App from this module in UWP with EF7 and SQLite and watch it run on emulators for phones and tablets.

Module 6: Interacting with the Team

This module is about how EF7 is being developed openly on GitHub at and the story has not changed. The team continues to be eager to have developers try out EF7 and provide feedback in the form of issues or even Pull Requests. They continue to publish their team meeting notes on the wiki where we can converse with them further about their ideas.

The EF7 RoadMap

The roadmap did not exist when I created the course. It is a great resource and I encourage you to check it out at

I continue to bang on EF7 and pester the team when I’m confused. When EF 7.0.0 releases, I will create a Getting Started course that will dig further into EF7 as a full released framework.

A Few Notes About Mappings

Since the course there were a few things I learned that either didn’t exist at the time or I just didn’t know about that I think are worth mentioning.

The pluralization support we’ve been used to in the past does not exist in EF7. If you have a model with an entity named Person and another name Order, EF (& migrations) will presume that the relevant tables are also named Person and Order.

The next point will help you address the pluralization.

Custom Conventions that we got in EF6 are not in RC1 and won’t be in the first itereation of EF 7. They are targeted towards a future release — and should be in EF7 by the time it becomes the “official” version of EF.

So a custom convention such as this is not yet possible:

(EF6->) modelBuilder.Properties<String>().Configure(p => p.HasMaxLength(50))

However, Rowan Miller points out in his gist ( that we can continue to use a hack that we had before custom conventions existed to help (but not magically solve) with table name pluralization. And thanks to the new Name property introduced in C#6 (& VB but remember, we don’t have VB support yet) you could iterate through the entities and apply someo rules. This gist of Rowan’s shows a simplistic “add s” rule:

foreach (var entity in modelBuilder.Model.GetEntityTypes())


modelBuilder.Entity(entity.Name).ToTable(entity.Name + “s”);


Support for Table per Hierarchy (TPH) mappings was added as of RC1.

EF7 can now infer 1:1 mappings without you having to specify the principal and dependent. If it doesn’t get it right then you can use updated HasMany/HasOne fluent mappings. (These have been simplified!)

Is Visual Studio Code Bugging You For Your User Name and E-Mail Address?


“Please configure your git user name and e-mail”

Are you seeing this message when trying to push changes from Visual Studio Code to github?

It turns out that all of those times I’d been pushing/pulling from the command prompt and entering my name and email each time could have been avoided with the same configuration. But Visual Studio Code wasn’t going to let me get away with that laziness.

I finally GoogleBinged the message and learned that the configuration is something you need to do from the command prompt.

git config --global yourname
git config --global [email protected]

In Case I Forget a Third Time: project.json config for referencing full .NET DLLs


I’ve been working with an ASP.NET 5 app that uses an EF6 module. The EF6 module is .Net 4.6.

When re-creating this from scratch, I keep making the same mistake which confounded me for hours the first time and only 15 minutes the second time. I like to think that the next time, I will remember how to do this in advance but decided I better write it down.

Here is the default project.json for a new ASP.NET 5 MVC app that does not have any identity infrastructure set. This was scaffolded directly by the ASP.NET 5 Web App template where I chose to have no authentication included. Also of note is that I’m using RC1.

  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true

  "dependencies": {
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions" : "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final"

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel"

  "frameworks": {
    "dnx451": { },
    "dnxcore50": { }

  "exclude": [
  "publishExclude": [
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]


I need to add a reference to my .NET4.6 class library project called EF6Model. This is not an ASPNET5 project. No dnx. No dnu. Just straight .NET. My first instinct is to add it into the dependencies section after ““Microsoft.VisualStudio.Web.BrowserLink.Loader”. It does nothing but fail fail fail. Squiggly lines. Can’t build. Only help is “sort”.

The core of the problem is that the default scaffold specified that this would be for dnx451 and dnxcore50 frameworks. My assembly is not recognized by dnxcore50. In the dependencies section, I am saying that everything in here should work with both frameworks. That’s not true.

If I know I am never going to need the dnxcore50, I can just remove it from the frameworks section:

 "frameworks": {
    "dnx451": { }

Also, the default .Net version here is 4.51. My dll is 4.6 so I have to fix that, too.

 "frameworks": {
    "dnx46": { }  },

This change will required that you run dnu restore  — well at least I had to do that! Smile 

You can also specify the dependency directly in the framework section instead of the dependencies section ala:

 "frameworks": {
        "dnx46": {
            "dependencies": {
                "EF6Model": "1.0.0-*"

I like this because it explicitly tells me that EF6Model is special and is only supported by dnx46. As I evolve my app and possibly make changes to the dependencies or even the frameworks, I know that what’s in the dependencies section should be supported by any targeted framework, while the framework specific dependencies are very obvious.

Having written this down, I hope now that it is now in my brain and I won’t have to waste time wondering about those errors any more.