Last post Sep 30, 2019 03:50 PM by tinac99
Sep 28, 2019 02:01 AM|tinac99|LINK
I have a solution target framework 2.2, which consists of 3 projects:
DAL : contains the SchoolDbContext, the models and viewmodels
BLL : contains the Business Layer
WebApp : supposedly MVC web app, except for the Model which is in the DAL layer.
I'm using .Net Core 2.2, Oracle 11.
I initially created the project with no authentication but am now trying to add Individual User Account Authentication to the working project. I also created the project using Database-First approach.
When I try to change
SchoolDbContext : IdentityDbContext
I get the error : 'SchoolDbContext' does not contain a definition for 'SaveChanges' and no extension method 'SaveChanges' accepting a first argument of type 'SchoolDbContext' could be found (are you missing a using directive or an assembly reference?)
I already installed the following nuget for all the projects:
install-package Microsoft.AspNet.Identity.Core -Version 2.2
install-package Microsoft.AspNet.Identity.Owin -Version 2.2
install-package Microsoft.AspNet.Identity.EntityFramework -Version 2.2
Install-Package Microsoft.Extensions.Identity.Stores -Version 3.0
When i try to clean and build the business layer, it gives the error, 'SchoolDbContext' does not contain a definition for 'SaveChanges' and no extension method 'SaveChanges' accepting a first argument of type 'ToolsDbContext' could be found (are you missing
a using directive or an assembly reference?) ToolsOracle.Business. This error did not exist in
Moreover, when I try to add New Scaffold Item -> Identity in the WebApp, it cannot find the SchoolDbContext in the Business layer. Then, It's generating the error "there-was-an-error-running-the-selected-code-generator".
Also, could anyone direct me to a good resource for implementing Authentication in an multi-layered MVC project, Database First, ASP.Net Core, ?
Sep 30, 2019 05:01 AM|yogyogi|LINK
If you do the all the steps of Identity correctly from start then you will not find these problem. Recheck all the steps and follow
Setup & Configuration of Identity management.
You are also following Database-First approach approach which is not good today. Programming has shifted to
Code First Approach where you create C# classes for database object, then run migration commands on VS, and your database is created automatically on SQL Server (or MySQL, oracle, etc).
Sep 30, 2019 03:50 PM|tinac99|LINK
Thanks, i'll try.