سؤال

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?

هل كانت مفيدة؟

المحلول

Try this:

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

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

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top