If you're using Entity Framework you might have noticed that your decimal values are defaulting to 2 decimal places in your database when it's being built.
Sometimes you'll want to store more than 2 decimal places for things like GPS co-ordinates.
I was working on one of my Entity Framework Code First websites the other day when I noticed the following error being returned to me:
There is already an open DataReader associated with this Command which must be closed first
Doing a few searches online I could see some of the solutions were to include the parameter 'MultipleActiveResultSets=True' in your entity framework setting in the web.config. However, when I checked my web.config to look for this setting I noticed that I did actually have it all setup as expected.
Doing some more digging around I noticed that the cause for this issue is down to an issue with deferred execution in some of my queries.
The solution was to add a simple .ToList() at the end of my query.
A simple fix but one that drove me nuts for a while!
If you're using Entity Framework migrations in a multi-project solution you might have noticed that when you run the 'Update-Database' action your database was given the name 'yourdatabase.Data.DataContext'. Some people don't mind this default naming scheme but I want to call my databases something a bit cleaner.