EF Core

GraphQL with ASP.NET Core (Part- VIII : Entity Relations - One to Many)

Read the previous part - GraphQL with ASP.NET Core (Part- VII : Mutation) Building a GraphQL end-point with a single entity ain't gonna cut it. In this post, we introduce two new entities for handling orders for a customer. The relationship between Customer and Order is one-to-many i.e. A customer can have one or many orders, whereas a particular order belongs to a single customer. You can configure entity relationship following entity framework conventions. Entity framework will auto-create a one-to-many relationship between entities if one of the entity contains…

Keep reading

GraphQL with ASP.NET Core (Part- VI : Persist Data - Postgres with EF Core)

Read the previous part - GraphQL with ASP.NET Core (Part- V : Fields, Arguments, Variables) This post focuses more on configuring a persistent data storage rather than discussing different aspects of GraphQL. With that being said, let's connect a Postgres database with our back-end. You may ask, why Postgres? Because everybody does SQL Server; so why not try out a different thing. In our data access layer, we will have a data store class or in another word a repository class. Since it's a good practice to code against abstraction;…

Keep reading

Enable Entity Framework Core (1.1.1) Migrations From Separate Assembly

Watch the video if you don't like reading: So, today I tried updating all my project packages to dotnet core 1.1.1. Everything went pretty well except the EF Core's 1.1.1 update. Like everyone else I like putting my DbContext and Repository files in a seperate assembly. A barebone DbContext class may look like this: public class ApplicationDbContext : DbContext { public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { } } Up until 1.1.0 I was able to run migrations. But today when I tried to add a…

Keep reading