I’ve setup a solution with a WebAPI and a MVC 4 application. I’m using the Entity Framework 5 which stores it data into a SQL Azure database. In the package manager console I typ: enable-migrations and get the error:
Unable to load the specified metadata resource.
This due to the context connectionstring in the web.config. Check if you have the right settings under <connectionStrings>
Suppose you have an existing Entity Framework database in production and you’ve made changes to the model in your C# project. Of course you have messed up / lost your migrations files. What to do?
– delete the _MigrationHistory table from the database
– delete the Migrations folder from you solution (you might want to keep a backup of the Configurations.cs file is you’ve made changes to that e.g. Seed)
– in the package manager console type:
- add-migration initialcreate -ignorechanges
Your all set!
I’m using breeze and WebApi 2. A navigation property is serialized OK, but is not present on the client side.
Solution: in OnModelCreating of the datacontect set the modelbuilder:
protected override void OnModelCreating(DbModelBuilder modelBuilder)
.HasRequired<MeetingSessionStatusPoco>(m => m.Status);
- create projects
- create tasks
- upload large files (multiple gigabytes)
- create tenders (RFP Request For Proposal)
- Invite suppliers to projects
- your suppliers can communicate with your customers via design-traffic, so your customers won’t know that you subcontracted the order
After making some (of in fact a lot of) changes to my persistent classes I get the error: Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong.
I’m using Entity Framework 6, code first and automatic migrations.
How did I solve this:
– run in the package manager console : update-database -verbose -sourcemigration $initialdatabase
Now you can see what is causing the migration to fail. In my case it was changing a one-many relationship to a many-to-many using a extra (explicit) linking table.
Remark: often the issue is with foreignkey and relationships. Since you perhaps try to modify the relationships, it could be necessary to modify of delete the related data, so SQL server can delete and recreate references on empty tables