I'm trying to follow this tutorial to create an ASP.NET Identity system, I've gotten about halfway down the page, however when I get to writing the following code
public async Task<string> AddUser()
{
ApplicationUser user;
ApplicationUserStore Store = new ApplicationUserStore(new ApplicationDbContext());
ApplicationUserManager userManager = new ApplicationUserManager(Store);
user = new ApplicationUser
{
UserName = "bla",
Email = "o@gmail.com",
};
var result = await userManager.CreateAsync(user);
if (!result.Succeeded)
{
return result.Errors.First();
}
return "User Added";
}
I get the error System.Data.Entity.Core.MetadataException: Unable to load the specified metadata resource.
I've looked online quite a bit for a solution however most of the posts involve .edmx files which neither this tutorial nor my solution contain. The connection string to my server is correct as I've used it on other projects in the past. Where am I going wrong?
My connection string is as follows:
<add name="PEARLEntities" connectionString="metadata=res://*/Models.UsersModel.csdl|res://*/Models.UsersModel.ssdl|res://*/Models.UsersModel.msl;provider=System.Data.SqlClient;provider connection string="data source=source;initial catalog=PEARL;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
The DbContext is based off the table in this connection string that was created using the following SQL
CREATE TABLE [dbo].[UsersTable](
[UserID] [int] IDENTITY(1,1) NOT NULL,
[UserName] [nchar](200) NOT NULL,
[Email] [nchar](200) NOT NULL,
[EmailConfirmed] [bit] NOT NULL,
[Password] [nchar](200) NOT NULL,
[Hospital] [nchar](200) NOT NULL,
[Salt] [nvarchar](500) NOT NULL,
CONSTRAINT [PK_UsersTable] PRIMARY KEY CLUSTERED
(
[UserID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO