Question

I am using Migrations, but I had to manually add a SQL View as it pulls from other tables that aren't going to be mapped in my context/repository.

However, now it thinks the context has changed. I saw this answer that asks the same question, but it doesn't solve the problem. I can't just create the view model from existing entities.

Is there another way? I wouldn't mind using SqlQuery if I could something like:

context.Database.SqlQuery<ContactsByPartyCampaignViewModel>("myView")

Do I need to drop migrations?

Was it helpful?

Solution

Try this:

Add this : Database.SetInitializer<MyDbContext>(null);

in Global.asax under Application_Start() will solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top