Nov 19, 2012 at 11:07 AM
Edited Nov 19, 2012 at 11:08 AM
I have created a ContentPartRecord with one property, and it is working as expected.
I am now in the process of upgrading the module, and I need to add a second property to the ContentPartRecord. I have added the new property to the Record and the Part classes, and have updated the cshtml file to display a textbox to allow the user to update
this value. I have also updated my migrations file to add a column to the table to store the new property.
However- when I go to save my record, my new property is not persisted but the original one is. More specifically, there appears to be two issues occurring here:
- In the Editor post method in the driver, the new property on the part is always passed as NULL.
- If I hard-code the new property to an arbitrary value immediately before I call IUpdateModel.TryUpdateModel, that method appears to ignore the new property and it is passed back as NULL
I'm not too sure what could be the cause of this, can anyone shed some light here?
One line of thought is that when the first property was created on the part, the migration looked like this:
public int UpdateFrom1()
SchemaBuilder.CreateTable("ScheduledGamesContainerRecord", table =>
.Column("NumberOfGamesToShow", col => col.WithDefault(10)));
I have added the new property like this:
public int UpdateFrom5()
SchemaBuilder.AlterTable("ScheduledGamesContainerRecord", table =>
Do I need to call ContentPartRecord again on the table? I cant see a way to do this on AlterTable. Any help would be greatly appreciated.