Reputation: 4274
I'm working with ASP.Net Core and attempting to move some of the Identity components into a separate assembly. I moved ApplicationDbContext
and ApplicationUser
into an assembly called DataModels
. (ApplicationUser
is in the Models
folder/namespace of DataModels
.)
In the WebApplication Startup.cs
I reference this assembly and everything compiles fine. I updated the AccountController to correctly reference this as well.
When I start up my app, I receive this:
An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.
The type or namespace name 'ApplicationUser' could not be found (are you missing a using directive or an assembly reference?)
public SignInManager<ApplicationUser> SignInManager { get; private set; }
My Startup.cs has this:
using DataModels.Models;
...
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<DataModels.ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<DataModels.ApplicationDbContext>()
.AddDefaultTokenProviders();
services.AddMvc();
// Add application services.
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
}
Obviously I'm not specifying the DataModels assembly somewhere, I'm just not sure where.
Upvotes: 1
Views: 790
Reputation: 4274
Found that it was referenced in these files:
_LoginPartial.cshtml
Login.cshtml
I needed to update those files with this:
@using DataModels.Models
Upvotes: 2