This project is read-only.

Migrations and ContentPartRecord question

Topics: Customizing Orchard, Writing modules
Mar 28, 2011 at 7:12 PM

  I'm writing my first module and I'm running into a roadblock with Migrations and ContentPartRecord instances.  The documentation says that a ContentPartRecord is a representation of what you're going to store in the database for your content part.  Thus, I would expect that any CreateTable call in Migrations.cs would pertain only to objects that inherit from ContentPartRecord.  However, I'm seeing classes that don't inherit from this class despite the fact that they are referenced in Migrations.cs and they are being persisted in the database anyway.  So, my question is: When should ContentPartRecord be used?  For that matter, when should ContentPart be used as well?  The documentation doesn't seem to line up with the actual usage.

Mar 28, 2011 at 7:49 PM

You can use Migrations to create or modify any database table. If you want that table to represent a ContentPart, you just inherit from ContentPartRecord and don't need to create a primary key. You can also use Migrations to set up content definitions. But it's for intended any database Migrations, not exclusively content-related.