I have a Seed method in my Migrations/Configuration.cs:
protected override void Seed(MVC4App.Models.MVC4Entities context)
{
try
{
// Initialize database for Account
WebSecurity.InitializeDatabaseConnection(
"MVC4Entities", "Users", "UserId", "Email", autoCreateTables: true);
If I try and run 'update-database -verbose' on my dev machine I get this error:
The "WebSecurity.InitializeDatabaseConnection" method can be called only once.
That is the only place in my code that it is called. How can I fix this?
Thanks
add a check for initialization :
if (!WebSecurity.Initialized)
{
WebSecurity.InitializeDatabaseConnection(
"MVC4Entities", "Users", "UserId", "Email", autoCreateTables: true);
}