This project is read-only.

How to add more fields to a Custom ContentPart

Topics: Customizing Orchard
Mar 18, 2012 at 12:00 PM

I have already created a contentpart and I need few more fields adding to that ContentPart. How to go about doing that?


Mar 18, 2012 at 4:19 PM

Add properties to the content part, the content part record, and add and UpdateFromX() method to your migrations.cs file. Basically follow the same procedure you did to create the content part. Also update the views to display/edit your part. 

Mar 20, 2012 at 4:05 PM
Edited Mar 20, 2012 at 4:05 PM

I have tried that way. The problem I am having is there is no Update method for the schemaBuilder. So how do I go about adding that. DO I need to create another table for this new property?


SchemaBuilder.CreateTable("Record", table => table
				.Column("Id", DbType.Int32)
Mar 20, 2012 at 4:38 PM

You can use the SchemaBuilder.AlterTable method to add and remove columns.

Mar 20, 2012 at 4:55 PM

That should do I think.