DEV Community

Discussion on: Entity Framework DotNet Core with GraphQL and SQL Server (using HotChocolate)

Collapse
 
lkoss12 profile image
Loren Koss

Great article! I recommend changing your AddDbContext to make the dbcontext with Transient scpe like this:
services
.AddDbContext(options =>
options.UseSqlServer(MyDbContext.DbConnectionString), ServiceLifetime.Transient);

With GraphQL, many queries could happen simultaneously and you will find that queries in one dbcontext cant be run at the same time.