The problem that I'm having is that I can't delete a row when using entity. I'm able to find the row, but the error I get the next error:
Additional information: Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions.
I tried updating the database in the package manager console, I tried several different ways of deleting the record, but no luck by the moment. Auto Migrations are enabled.
Below is the code I am currently trying to use.
var ctx = new Context();
ApplicationUser user = new ApplicationUser { UserName = myUsername };
ctx.Users.Attach(user);
ctx.Users.Remove(user);
ctx.Entry(user).State = EntityState.Modified;
ctx.SaveChanges();
All help is appreciated. I have been banging my head on this for hours.
UserNamea primary key ofApplicationUserentity? - Dennis