I'm using Entityframework with repository pattern using database. I'm getting the following error when I try to connect to the database
System.Data.Entity.Infrastructure.UnintentionalCodeFirstException was unhandled by user code HResult=-2146233079
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
How do I fix this?
If you are trying to connect to an existent database but EF try to do code first you should follow this easy steps to prevents this error.

Make sure you mark "Save connection setting in App.Config as"On other side if you don't see the screen of step 4 make sure that you have removed all connection string of your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With