calendar_today 15 August 2018 13:46
Query Types, introduced in Entity Framework Core 2.1 enable you to return non-entity types that map to tables or views and can serve as the return type from FromSql method calls.
calendar_today 26 March 2018 08:50
Most migrations that you execute when working with Entity Framework Core are likely to be straightforward - resulting in nothing more than an adjustment to the database schema. Sometimes, however, you might also want to include a task that requires longer than the default command timeout value (30 seconds in SQL Server) such as importing a lot of data.
calendar_today 28 October 2016 08:50
Redesigning a framework from the ground up provides an opportunity to implement an improved API. The team working on Entity Framework Core have certainly grabbed that opportunity in respect of the DbContext class, which sees a bunch of new data manipulation methods not available in Entity Framework 6 or earlier.
calendar_today 11 October 2016 21:40
Entity Framework Core is the new lightweight version of Entity Framework designed to work with .NET Core applications. Just like ASP.NET Core, it has been rewritten from the ground up, and includes some new ways of doing things. One of those is the introduction of the TrackGraph method for handling complex data in disconnected scenarios such as MVC or Web API applications.
calendar_today 16 June 2016 07:38
A key reason behind the decision to use an ORM such as Entity Framework for your data access is to reduce or eliminate the need to write SQL as part of the development process. Nevertheless, there are times when you might need to make use of database stored procedures, and Entity Framework 6 Code First provides support for using existing stored procedures as well as generating new ones.
calendar_today 13 May 2016 08:13
The search facility on this site has been rudimentary at best. I have recently upgraded it to take advantage of the Full-Text Search feature in SQL Server. Although it is still a basic implementation, it is a vast improvement on the search system that existed before, which was based on Entity Framework dynamically generating SQL LIKE clauses. This article describes how I got SQL Server Full-Text Search up and running.
calendar_today 18 June 2015 13:56
This article looks at how to configure Entity Framework to manage many to many relationships based on the same table. This scenario arises the same entity is related to itself in a different role. An example is the related product feature you might see in a "People also bought" section of an ecommerce site. Another is the relationship between clients and agencies in the advertising and marketing world. That scenario will form the basis of the illustration below.
calendar_today 23 April 2015 13:19
This post explores the options available to you when your application requirements include managing and storing time using the Entity Framework. Specifically, I am thinking of durations of time, such as the time required to complete some kind of task, not the time part of a date. Relevant examples might include storing the length of a movie, or the preparation time required for a recipe.
calendar_today 18 February 2015 13:16
If you have built sites with the ASP.NET Razor Web Pages framework, you might want to look at migrating them to ASP.NET MVC at some point. This tutorial is the second in a series of three that explores how you do that by taking a step by step approach to migrating the WebMatrix Bakery template site to ASP.NET MVC 5. Along the way, each of the core parts of MVC are discussed by way of an introduction to the framework. The tutorial is divided into three parts. The first part looked at the roles of the View and Controller. This part looks at the M in MVC, the Model. Specifically, it features data access and view models. The final part will cover model binding and form posting. A download (c. 24MB) featuring the completed application is available on GitHub.
calendar_today 12 January 2015 20:38
This is the latest in a series of "EF Recipes" - short articles that show through practical examples how to achieve common tasks with Entity framework and ASP.NET MVC. This particular example looks at grouping data by year and month in MVC 5 with Entity Framework 6. The article is prompted by an email I got from a reader who asked how I generate the "Archives" feature in the right hand panel on each page on this site.
calendar_today 29 October 2014 20:53
This article looks at using the alphabet for paging data in MVC 5 with Entity Framework 6. Where it differs from most existing articles on alphabetical paging is that this article looks at generating paging links from the data instead of the alphabet. It also features a Bootstrap-friendly helper for generating the paging links.
calendar_today 24 October 2014 22:20
This article explores how to use Entity Framework 6 to manage the retrieval and display of hierarchical data such as you might find in a menu system. There are a number of existing items on the Internet that cover the same topic, but most of them seem unnecessarily complex and don't include any information about displaying the data once it has been retrieved.
calendar_today 13 June 2014 13:42
This tutorial is the last in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. This final tutorial introduces several topics that are useful to be aware of when you go beyond the basics of developing ASP.NET web applications that use Entity Framework Code First. Step-by-step instructions walk you through the code and using Visual Studio Express For Web for the following topics:
calendar_today 13 June 2014 13:42
This tutorial is the eleventh in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In the previous tutorial you handled concurrency exceptions. This tutorial will show you how to implement inheritance in the data model.
calendar_today 13 June 2014 13:41
This tutorial is the tenth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In earlier tutorials you learned how to update data. This tutorial shows how to handle conflicts when multiple users update the same entity at the same time. You'll change the web pages that work with the Department entity so that they handle concurrency errors.
calendar_today 13 June 2014 13:40
This tutorial is the ninth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In earlier tutorials you learned how to read and update data using the synchronous programming model. In this tutorial you see how to implement the asynchronous programming model. Asynchronous code can help an application perform better because it makes better use of server resources.
calendar_today 13 June 2014 13:39
This tutorial is the eighth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In the previous tutorial you displayed related data; in this tutorial you'll update related data. For most relationships, this can be done by updating either foreign key fields or navigation properties. For many-to-many relationships, the Entity Framework doesn't expose the join table directly, so you add and remove entities to and from the appropriate navigation properties.
calendar_today 13 June 2014 13:39
This tutorial is the seventh in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In the previous tutorial you completed the School data model. In this tutorial you'll read and display related data — that is, data that the Entity Framework loads into navigation properties.
calendar_today 13 June 2014 13:38
This tutorial is the sixth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. In the previous tutorials you worked with a simple data model that was composed of three entities. In this tutorial you'll add more entities and relationships, and you'll customize the data model by specifying formatting, validation, and database mapping rules. You'll see two ways to customize the data model: by adding attributes to entity classes and by adding code to the database context class.
calendar_today 13 June 2014 13:37
This tutorial is the fifth in a series of 12 that teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. This tutorial covers how to enable Code First Migrations and then deploy your database to Windows Azure. The Migrations feature enables you to change the data model and deploy your changes to production by updating the database schema without having to drop and re-create the database. The section covering deployment to Azure is optional; you can continue with the remaining tutorials without having deployed the project.
calendar_today 13 June 2014 13:36
This tutorial is the fourth in a series of 12 which teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. This tutorial covers how to use two features of Entity Framework 6 that are especially valuable when you are deploying to the cloud environment: connection resiliency (automatic retries for transient errors) and command interception (catch all SQL queries sent to the database in order to log or change them).
calendar_today 13 June 2014 13:35
This tutorial is the third in a series of 12 which teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. This tutorial explores how to add sorting, filtering and paging to MVC 5 Views using the Entity Framework. You will also look at implementing simple Grouping.
calendar_today 13 June 2014 13:34
This tutorial is the second in a series of 12 which teach you how to build MVC 5 applications using Entity Framework for data access and Visual Basic. Here, we look at implementing basic CRUD (Create, Read, Update and Delete) using the scaffolding that ASP.NET MVC provides, as well as customising the resulting code.
calendar_today 13 June 2014 13:33
This tutorial is the first in a series of a Visual Basic versions of the Getting Started with EF 6 using MVC 5 tutorials published on the www.asp.net site. The original series, produced by Tom Dykstra and Rick Anderson ( @RickAndMSFT ) was written using the C# language. My versions keep as close to the originals as possible, changing only the coding language. The narrative text is largely unchanged from the original and is used with permission from Microsoft.
calendar_today 09 April 2014 13:45
I managed to generate this error twice within a few days while working with the Entity Framework and SQL Server 2012. I had to resort to searching for a resolution on both occasions so I'm posting about it to sear the cause and solution into my brain.
calendar_today 28 August 2013 20:14
Entity Framework Code First Migrations enable changes to your model to be propagated to your database through code. Prior to the introduction of migrations, changes to the model resulted in the database being recreated from scratch with attendant loss of data. During development, this may not cause too many problems, but once the database has been deployed into production, it's another story. Migrations solve the problem in that changes are applied to the database schema without loss of data.
calendar_today 22 July 2012 20:46
If you want to build AJAX powered rich client interfaces with ASP.NET Web Pages, you will work with JSON - a lot. You might also be attracted to the Entity Framework for your data access technology. There are some special considerations to take account of when serialising Entity Framework objects to JSON for use in Web Pages applications. This article explores some of the issues you will encounter through the example of a simple To Do list manager.
calendar_today 30 December 2011 15:25
Since I published an item covering Code First development with Entity Framework and WebMatrix, I have had a few requests to provide a guide to working with the Entity Framework from a database first point of view. This post answers those requests and provides a step by step guide to getting up and running with a WebMatrix web site based on the Northwind sample database that comes with SQL Server CE 4.0.
calendar_today 05 September 2011 17:27
The existing data access story for WebMatrix is the Database Helper. Microsoft's recommended data access technology going forward is the Entity Framework (EF). This article explores how to use the Code First capability offered by EF within an ASP.NET Web Pages application.
calendar_today 10 October 2009 22:46
As you delve more into ASP.NET MVC you start to come across a whole new way of doing things that Web Forms development didn't really expose you to. Inversion of Control (IoC) and Dependency Injection (DI) are two phrases that crop up a lot in the MVC space. So what are they all about? And should you care?
calendar_today 28 June 2009 21:37
Building on my previous article, which looked at adding data with one-to-many and many-to-many relationships via the Entity Framework, here's a look at how to modify that data within an ASP.NET MVC application.
calendar_today 17 June 2009 21:55
Taking on two new technologies - ASP.NET MVC and the Entity Framework - at the same time was bound to provide some "interesting" moments. Getting data out via EF has so far been pretty straightforward. But when it got to building the back end of my site, I had some fun trying to manage INSERTS with One-To-Many and Many-To-Many relationships.
calendar_today 01 June 2009 07:26
A Tag Cloud is a visual depiction of Tags or categories on a web site. CSS is used to set the variable font size of each Tag to illustrate its relative frequency or popularity within the site. As part of the migration of my site to ASP.NET MVC, I am introducing one to replace the Categories navigation that appears on the left hand side of each page, which contains a count of items within each category.
calendar_today 11 May 2009 07:06
I'm in the process of rewriting mikesdotnetting.com using the ASP.NET MVC framework. It's an interesting experience, in that this is my first exposure to MVC. The first stumbling block I encountered was how to pass data in a satisfactory way to Partial Views which only represent part of the data that is to be displayed in the View. Since I struggled to find clear guidance on this, I thought I would share a way to do it.