Jak zrobić migrację?

0

Witam,
Zmieniłem sobie nazwę jednego pola w modelu z ID na ExamID. Teraz próbuję zrobić migrację:

enable-migrations -ContextTypeName WebExam.DAL.WebexamContext
add-migration InitialCreate

//Dostaję
The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration InitialCreate' again.
 
 
PM> add-migration
cmdlet Add-Migration at command pipeline position 1
Supply values for the following parameters:
Name: Mig1
Unable to generate an explicit migration because the following explicit migrations are pending: [201504191116462_InitialCreate]. Apply the pending explicit migrations before attempting to generate a new explicit migration.
PM> update-database
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
Applying explicit migrations: [201504191116462_InitialCreate].
Applying explicit migration: 201504191116462_InitialCreate.
Running Seed method.

Czy moja migracja zrobiła się poprawnie?

Teraz dostaję taki błąd. Poprawiłem sobie to: id=item.ID na id=item.ExamID. Pytanie czy istnieje jakiś automatyczny sposób na poprawę takich błędów czy trzeba wszędzie ręcznie poprawiać?
Błąd:

 
Server Error in '/' Application.

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: CS1061: 'WebExam.Models.Exam' does not contain a definition for 'ID' and no extension method 'ID' accepting a first argument of type 'WebExam.Models.Exam' could be found (are you missing a using directive or an assembly reference?)

Source Error:


Line 30:         </td>
Line 31:         <td>
Line 32:             @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
Line 33:             @Html.ActionLink("Details", "Details", new { id=item.ID }) |
Line 34:             @Html.ActionLink("Delete", "Delete", new { id=item.ID })

Source File: d:\Documents\Visual Studio 2013\Projects\WebExam\WebExam\Views\Exams\Index.cshtml    Line: 32 


Show Detailed Compiler Output:

Show Complete Compilation Source:

1
gcmarcin napisał(a):

Teraz dostaję taki błąd. Poprawiłem sobie to: id=item.ID na id=item.ExamID. Pytanie czy istnieje jakiś automatyczny sposób na poprawę takich błędów czy trzeba wszędzie ręcznie poprawiać?

Rename w ReSharperze zmieni nazwę także w plikach cshtml. Goły VS chyba nie potrafi.

Migracje to coś związanego z tym śmiesznym EF, więc tagi "asp.net" i "mvc" są bez sensu.

1 użytkowników online, w tym zalogowanych: 0, gości: 1