Helping you solve those tough coding problems!
Learn some great web development and web design tips and techniques through recipes that clearly define the problem being solved with a working solution.
Popular Tags: cakephp | theory | optimization | javascript-development | asp-net | css | jquery-development | sql | ajax | c

Search:
Follow @endyourif rss Facebook LinkedIn

Improving the performance of slow Entity Framework queries Improving the performance of slow Entity Framework queries

Published on Apr 18, 2019 by Jamie Munro

I'm a big fan of Entity Framework. It makes working with databases very convenient. I've discussed previously how I use Entity Framework to implement the repository pattern. Of course with ease of development sometimes sacrifices performance. In today's article I'm going to explain my favorite approach to improve the performance of Entity Framework queries that are slow.

Read more >

Tags: SQL | Optimization | Entity Framework | entity framework

Improving the performance of slow Entity Framework queries Improving the performance of slow Entity Framework queries

Published on Apr 18, 2019 by Jamie Munro

I'm a big fan of Entity Framework. It makes working with databases very convenient. I've discussed previously how I use Entity Framework to implement the repository pattern. Of course with ease of development sometimes sacrifices performance. In today's article I'm going to explain my favorite approach to improve the performance of Entity Framework queries that are slow.

Read more >

Tags: SQL | Optimization | Entity Framework | entity framework

Preventing race conditions with sp_getapplock Preventing race conditions with sp_getapplock

Published on Apr 17, 2019 by Jamie Munro

I am a big proponent of storing calculated fields in the database opposed to calculating them each time they are displayed. They only change at specific times so you just need to cover those spots to calculate them. The danger with storing calculated fields is that concurrent calls have a chance incorrectly calculating the field. Languages such as C# offer the ability to lock objects to help with this. However, in a multi-server example, locking on a single server will not work. In this article I'm going to demonstrate how to use sp_getapplock to prevent race conditions.

Read more >

Tags: SQL | Entity Framework | ASP.NET | mssql | sp_getapplock

Updating specific fields using Entity Framework Updating specific fields using Entity Framework

Published on Mar 25, 2019 by Jamie Munro

Entity framework does a great job of detecting when a field changes on any object that it is tracking. These changes will be automatically saved when SaveChanges is executed. As I discussed in Why the Repository Pattern I like to create a Generic Class that is type T where T is a Model in my Entity Framework Context. This example will extend upon those examples.

Read more >

Tags: Entity Framework | mvc

Entity Framework's Code-First with an ObjectContext Entity Framework's Code-First with an ObjectContext

Published on Mar 20, 2019 by Jamie Munro

If the following blog interests you, it's probably because you're using Entity Framework with a Code-First approach and whatever it is you are trying to do *must* use an ObjectContext instead of the standard DbContext. I'm sure, like me, you thought this shouldn't be too hard. Then you started hitting roadblocks like, Metadata is required in your connection string. What's metadata? This is only needed in Database-First so you can tell the framework where your edmx and other definition files are, so why do I need this with Code-First, I don't have these files?

This was definitely my first reaction as well. So after much trial-and-error and research, I have the solution!

Read more >

Tags: ASP.NET | c# | entity framework

Why the Repository Pattern Why the Repository Pattern

Published on May 20, 2013 by Jamie Munro

Entity Framework Beginnerís Guide Done Right Entity Framework Beginnerís Guide Done Right

Published on May 13, 2013 by Jamie Munro