Create query for projector in migration (well in code)

Topics: Customizing Orchard
Feb 19, 2013 at 8:01 PM
Hi,

Apologies if this has been answered already but the codeplex search seems a bit flaky.

I was wondering if its possible to create a query for use with Projector etc from code (ie i could create one in a module migration ..).

Thanks!
Carl.
Coordinator
Feb 19, 2013 at 10:45 PM
Everything in Orchard can be done in code. Why do you want to do this, however, instead of just querying directly?
Feb 20, 2013 at 7:21 AM
Edited Feb 20, 2013 at 7:22 AM
Basically i'm writing a module for a client that includes all their customisations for orchard (sets up all their content types in the migration etc). One of the types has a part with a ContentPickerField. Its my intention to use the new version of contentpicker which allows you to limit the content to a query. It would be nice if i could setup that query and the field in the modules migration, so there is no setup needed when the module is enabled.

I have since managed to create a query, and assign that query tot he field in the migration - just need to figure out how to add a filter to said query now.
Coordinator
Feb 21, 2013 at 2:26 AM
What about recipes?
Feb 21, 2013 at 7:26 AM
hmm not a bad idea, will look into it see if i can achieve what i need too with them!