In my case, I was using the ASP.NET Identity Framework. I had used the built in UserManager.FindByNameAsync
method to retrieve an ApplicationUser
entity. I then tried to reference this entity on a newly created entity on a different DbContext
. This resulted in the exception you originally saw.
I solved this by creating a new ApplicationUser
entity with only the Id
from the UserManager
method and referencing that new entity.