Migrations
-
Entity Framework 'could not load assembly' error message
I usually setup a new solution so that it contains multiple projects. There's a project for web files, data files, services, utilities and so on. When I downloaded and setup Entity Framework through Nuget I installed it into my Project.Web (where all my views/controllers are) and to my Project.Data (where my data context is located with my repositories) projects.
I installed EF Migrations to my Project.Data project as this is where my data context file lives. Everything compiles and run but sometimes when using Entity Framework Migrations I noticed that I was getting an error:
Could not load assembly 'Project.Data'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)
-
Allow Entity Framework store more than 2 decimal places
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.
-
How to force your database name using Entity Framework migrations in a multi-project solution
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.