Query custom content type

Topics: Customizing Orchard, Writing modules
Mar 7, 2012 at 9:02 PM
Edited Mar 7, 2012 at 9:04 PM

I'm trying to use the new Query and Projector features in Orchard v1.4 with a content type I'm building using the following migration code:

	public int Create() {
			SchemaBuilder.CreateTable("WhatsNewRecord", table => table

			//Make this content part attachable to any content type
			ContentDefinitionManager.AlterPartDefinition(typeof(WhatsNewPart).Name, c => c
				.WithField("Picture", cfg => cfg.OfType("MediaPickerField")
					.WithDisplayName("Thumbnail Image")
					.WithSetting("Required", true.ToString()))
				.WithField("Html", cfg => cfg.OfType("TextField")
					.WithSetting("Flavor", "Html")
					.WithSetting("Required", true.ToString()))
				.WithField("Url", cfg => cfg.OfType("LinkField")
					.WithDisplayName("Link for the Image")
					.WithSetting("LinkText", "Required")
					.WithSetting("TargetMode", "NewWindow")
					.WithSetting("Required", true.ToString())));

			ContentDefinitionManager.AlterTypeDefinition("Promotion", cfg => cfg
				.WithSetting("Description", "A promotional item"));

return 1;

I created a query that only filters on a ContentType = "Promotion" and displayed as a simple Html list. When I preview the query results or use it with a projection I only get the metadata (creation date) back for each Promotion. How can I include, say, the value of the TextField part in my query result?

Mar 8, 2012 at 1:16 AM
Edited Mar 8, 2012 at 1:16 AM

With placement. Or a property-based layout and maybe a few additional bindings.

Mar 8, 2012 at 12:59 PM

Placement was exactly my problem.

I use these parts in a widget as well and so I usually hide away the default rendering of each field. I forget that placement affects the admin screens as well. 

Thanks for the help.