can't make it work entity framework migrations
-
When I executed the command update-database an getting the following error: Update-Database : Code generated using the T4 templates for Database First and Model First development may not work correctly if used in Code First mode. To continue using Database First or Model First ensure that the Entity Framework connection string is specified in the config file of executing application. To use these classes, that were generated from Database First or Model First, with Code First add any additional configuration using attributes or the DbModelBuilder API and then remove the code that throws this exception. At line:1 char:16 + Update-Database <<<< -verbose + CategoryInfo : NotSpecified: (:) [Update-Database], UnintentionalCodeFirstException + FullyQualifiedErrorId : System.Data.Entity.Infrastructure.UnintentionalCodeFirstException,System.Data.Entity.Migrations.UpdateDatabaseCommand What I'm doing wrong??
-
Answer:
I think the problem is that you are using a Code Generation Template to get you Entity classes from the model. If you want to use EntityFramework.Migrations, you should change your approach to Code First. What you can do is copy all the Entity Classes generated from the T4 template on another folder, delete the model (EDMX) and the other T4 files, and then add the Entity Classes that you backed up before again to your project.
Jorge at Stack Overflow Visit the source
Related Q & A:
- Why can't I make PC to PC calls with Messenger anymore?Best solution by Yahoo! Answers
- Why can't I make an attachment?Best solution by Yahoo! Answers
- Why can't I get my wireless headphones to work?Best solution by Yahoo! Answers
- Why can't my air conditioner work correctly?Best solution by AllExperts
- Why can't I get my Emerson to work with my Direct TV remote.Best solution by answers.yahoo.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.