Hi,
I have a multi layered application (Project name ShoppingOnline) and this project is based on Repository pattern that has a generic repository patterrn and this project contains the following Layered:
1. Products.Application (Class Library Project)
2. Products.Domain (Class Library Project)
3. Products.Infrastructure.Persistance (Class Library Project)
4. Shared Folder that contain a project Products ShoppingOnline.Comman (Class Library Project)
5.ShoppingOnline (The main Web API Project)
The project Products.Application contains Commands and Queries, The project Products.Domain just contains all the Entity Models (Mapping models to the database), the project Product.Infrastructure.Persistance contains my DbContext class IProductDbContext inherited from DbContext class, ProductsDbContextFactory.cs inherited from DbContextFactory class, DatabaseInitializer.cs class and ProductsRepository class inherited from the generic Repository IRepository.cs class and IProductsRepository class. The Common project ShoppingOnline contains IRepository.cs and Repository.ca classes.
This project is based on Code first approach and i have issue in Migration command when i execute the following migration command it give me the error:
Migration Command: Add-Migration Initial-Migration
The above command generate the following error:
Your target project 'ShoppingOnline' doesn't match your migrations assembly 'ShoppingOnline.Common'. 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("ShoppingOnline")). 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.
Please help me in the migration command and Update-Database command. Thanks
Following is the project structure screen shot: