Blog Posts for: Entity Framework

Unit testing ASP.NET 5 Controllers with Entity Framework 7 In-Memory Database

24 November 2015

Introduction A number of months ago I wrote about how you could unit test with Entity Framework using a fake DbSet and NBuilder. It’s been almost 4 months since that post and I have done quite a lot of work using ASP.NET 5 in the meantime. So I thought I would write an updated version of that blog post, using ASP.NET 5 and Entity Framework 7. In this blog post I am going to show you a very simple scenario where I have a ProductsController class which displays a list of products, and also allows the user to select a product and navigate to a details page.

Moving your Entity Framework 7 models to an external project

27 October 2015

Introduction In most of my projects - except perhaps for the most basic ones - I like to keep my Entity Framework data context and models in a separate project from my main ASP.NET application, so I can easily share it amongst other projects in the solution. I had to figure out how to do this in a new ASP.NET 5 project recently, and could not find any sort of guidance for this available on the web.