This project is read-only.

Where is table name of a contentpart saved

Topics: Core, Writing modules
Mar 23, 2012 at 6:16 AM

I am trying to find the db changes that happen when a module is enabled.

I would like to know where will orchard save the table name of my ContentPart Record when we create table in the migration class.

public int Create()
            // Creating table MapRecord
            SchemaBuilder.CreateTable("MapRecord", table => table
                .Column("Latitude", DbType.Single)
                .Column("Longitude", DbType.Single)

            ContentDefinitionManager.AlterPartDefinition(typeof(MapPart).Name, cfg => cfg

            return 1;


Mar 23, 2012 at 11:00 AM

You can see how this works by looking at the implementation of the SchemaBuilder. As you'll notice, the specified table name will simply be prefixed with some string value based on your module's name, and then that prefixed name is used to a call to create the actual table. To know how the prefix delegate is implemented exactly, you'd need to find the places where the SchemaBuilder is instantiated (I use ReSharper a lot to find where something is used or implemented).