I am learning ASP.NET Core Web API, and I created a project about movies for doing crud operations. I created the project and my mentor told me to create a new class library and write all methods and data operations from that library, and add a reference to the main project and use dependency injection. But while I try to migrate the data, I get an error:
Your target project 'MovieAPI' doesn't match your migrations assembly 'MovieManagementLibrary'. Either change your target project or change your migrations assembly.
Change your migrations assembly by using DbContextOptionsBuilder. E.g. options.UseSqlServer(connection, b => b.MigrationsAssembly("MovieAPI")). By default, the migrations assembly is the assembly containing the DbContext.
Change your target project to the migrations project by using the Package Manager Console's Default project drop-down list, or by executing "dotnet ef" from the directory containing the migrations project.
I am using Entity Framework Core and SQL database
DbContext
class
using Microsoft.EntityFrameworkCore;
using MovieManagementLibrary.Models;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
namespace MovieManagementLibrary.Data
{
public class MovieDbContext : DbContext
{
public MovieDbContext(DbContextOptions<MovieDbContext> options) : base(options)
{
}
public DbSet<Movie> Movies { get; set; }
}
}