Wednesday, July 24, 2019

rather than a non-generic DbContextOptions parameter

Consider this error:

The DbContextOptions passed to the PlayerContext constructor must be a DbContextOptions<PlayerContext>. When registering multiple DbContext types make sure that the constructor for each context type has a DbContextOptions<TContext> parameter rather than a non-generic DbContextOptions parameter.

 
 

To get around this error, I changed this...

using Microsoft.EntityFrameworkCore;
using FluffyNothing.Core.Objects;
namespace FluffyNothing.Infrastructure.ExternalDependencies.Repositories
{
   public class PlayerContext : DbContext
   {
      public PlayerContext(DbContextOptions options) : base(options)
      {

 
 

...to this:

using Microsoft.EntityFrameworkCore;
using FluffyNothing.Core.Objects;
namespace FluffyNothing.Infrastructure.ExternalDependencies.Repositories
{
   public class PlayerContext : DbContext
   {
      public PlayerContext(DbContextOptions<PlayerContext> options) : base(options)
      {

No comments:

Post a Comment