Entity Framework Core logo

How to instantiate your DbContext outside your Data project?

When you’re in your .NET Core project, it’s always easy: you just register your DbContext in ConfigureServices, and then inject it into whichever Page, View or Controller you might need it in. However, when you have another project or solution you’re working on and you’d still like to use the same DbContext and your entity classes in it, you have to find another way to do it! What should we do, then? Description Let’s first take a look at the use cases and tech stack.…Continue reading How to instantiate your DbContext outside your Data project?

.NET Core fundamentals in one picture.

How to add creator/modified info to all of your EF models at once in .NET Core

This is a tip that should often be the first thing you do in your projects with database backend, no matter which technology you use: Add some basic info about modified and created times, and the user information – so that if something happens, everyone will know who to blame 😉 There’s a lot of great blog articles describing how to do this in .NET Framework, but not that many for .NET Core. It’s very similar, but not the same. I learned that by copy-pasting…Continue reading How to add creator/modified info to all of your EF models at once in .NET Core

Miina (@minepupper) is fixing them bugs

EF Core returns null for a Navigation property

This article describes how to fix a situation, where you can’t use any of the navigation properties of your Entity Framework Core entities, since they are all null, despite data being in the database for sure. So, another day, another error. This time I can’t blame SharePoint, since I just messed up with ASP.NET Core and Entity Framework Core. :) Symptoms No matter what I’d do, I was getting null values for my navigation properties on my entities. They’d would always be null during runtime…Continue reading EF Core returns null for a Navigation property

Azure Functions CLI - such a pretty logo for such an awesome functionality

How to access EF’s DbContext in an Azure Function on V2 runtime?

This post describes how you can access your Entity Framework Core model classes and the database context in your Azure Functions. In my example I’m using EF Core 2.1, but the main principle should be the same for later versions as well. Please note, that I use Azure functions runtime 2.x (and so should you!) Another easy one, that I was unable to find much guidance on! But first, let’s start with the basics. Why would you want to have this setup? Why would you…Continue reading How to access EF’s DbContext in an Azure Function on V2 runtime?

entity-framework-logo

EntityFramework Core – Update-Database error “The EntityFramework package is not installed”

Another weird, but simple issue I ran into when building a simple .NET Core application. I was just minding my own business, crafting since bits of code into something remotely functional, while I ran into an issue. While trying to apply my changes to the database using .NET Core Entity Framework, executing Update-Database simply failed with the following error: The EntityFramework package is not installed You might also encounter this version of the error: The EntityFramework package is not installed on project [projectname here]. This…Continue reading EntityFramework Core – Update-Database error “The EntityFramework package is not installed”

Let's fix all the problems!

Fixing “An assembly specified in the application dependencies manifest [projectname].deps.json was not found”

This post describes one nobrainerish fix to the error “An assembly specified in the application dependencies manifest [projectname].deps.json was not found.” I ran into this while running Update-Database for my ASP.NET Core web project, that’s using EntityFrameworkCore 2.1.1. I hadn’t seen this one before, but the error was quite interesting: Error: An assembly specified in the application dependencies manifest (Koskila.[projectname].AzureFunctions.deps.json) was not found: package: ‘Koskila.[projectname].AzureFunctions’, version: ‘1.0.0’ path: ‘Koskila.[projectname].AzureFunctions.dll’ Well that’s a weird one coming from an update-database command! Posts Related to “Fixing “An assembly…Continue reading Fixing “An assembly specified in the application dependencies manifest [projectname].deps.json was not found”