Stored Procedures, Views and Transaction Error handling with Code First Entity Framework


chsakell's Blog

Code First doesn’t support Stored Procedure mapping by default, at least in the way Database First does (from the designer window). More over, it has an unusuall way to map a Domain Model class to a database view. This post will show you how to:

  1. Map a domain model to a database View
  2. Call a stored procedure via the DbContext
  3. Handle database transactions errors

Before starting building the application, I strongly recommend those who are new to Code First read the first two parts of these series, Part 1 and Part 2. I always use Visual Studio 2012 for my applications but this time due to circumstances, I will build the project in VS 2010 SP1. That shouldn’t be a problem though, for those who want to use VS 2012. Let’s start.

Create a blank solution named Corporation and add a c# class library project to it, named Model

View original post 792 more words