Valeriya
Valeriya

Reputation: 1127

ASP.NET 4.5, MVC 5, EF Db first with Identity T4 template, unable to find package NuGet

I have VS 2013, Update 4, if it's relevant.

ASP Identity supports only code-first, but I have an existing database. So, I'm trying to install T4 template for EF db first with ASP Identity, following instructions from https://github.com/cbfrank/AspNet.Identity.EntityFramework

Installed EF Power Tools successfully. Next step was to install T4 template from NuGet:https://www.nuget.org/packages/cb.AspNet.Identity.EntityFramework.T4/

But when trying to install from NuGet Console, I get error:

"Install-Package : Unable to find package cb.AspNet.Identity.EntityFramework.T4"

I haven't found any instructions on how to install the package manually.

Please advise, how to install this T4 template or suggest other solution - how to use ASP Identity with existing database.

Thank you.


Update:

I've followed instructions from Daniel Eagle's blog (see my comment for url, system doesn't allow to paste hyperlink) However, when I tried to run application and register a new user, exception appeared:

"The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database

Exception Details: System.InvalidOperationException: The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database.

Source Error:

Line 153: { Line 154: var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; Line 155: var result = await UserManager.CreateAsync(user, model.Password); Line 156: if (result.Succeeded) Line 157: {

Source File: c:\Users\Valeriya\Documents\Visual Studio 2013\Projects\Bulk_mailer_6\Bulk_mailer_6\Controllers\AccountController.cs Line: 155 "

Upvotes: 2

Views: 801

Answers (1)

Sergey Kolodiy
Sergey Kolodiy

Reputation: 5909

The error you have indicates that your entities changed after the database was created by Entity Framework Code First. You can manually delete the database or use Code First Migrations as exception suggests.

Upvotes: 0

Related Questions