Contents tagged with Orchard

  • Joining Orchard part records in HQL

    In yesterday’s post, I showed the basics of HQL querying in Orchard. It is by far the most flexible way to  query Orchard’s database, but one thing I didn’t show is how this works in relation to Orchard’s content type system. Querying over records is nice, but if those records are part records, you need to be really careful and check that they correspond to a real content item, that his content hasn’t been archived, and that its publication state is what you need it to be. In order to do that, you’ll have to join with ContentItemRecord and ContentItemVersionRecord. But how do you express joins in HQL in a way that works with Orchard records?

    Read more...

  • Querying Orchard in HQL

    Orchard has two APIs on IContentManager to query content items: Query, and HqlQuery. Query is the older API, but it’s also the simplest. It’s great when you want to perform a simple query such as “get all content items with part TitlePart where the title begins with A”. HqlQuery is a little more advanced, closer to nHibernate APIs, and allows for more complex queries. It was added to build the dynamic queries necessary for Projections. It is still, however, designed around the Orchard content type system, which makes it inadequate for queries that don’t trivially map to content items and parts.

    Read more...

  • Speeding up pages with lots of media content items

    For a few versions now, Orchard has been treating media (images, videos, etc.) as content items. There is a special kind of field, MediaLibraryPickerField, that enables you to add images, or collections of images, to any content type. For example, on the Nwazet web site, I’ve added a “Image Gallery” field to the product content type:

    Read more...

  • Strongly-typed HTML helpers in Orchard shapes

    Orchard uses dynamic objects called shapes as view models. It happens commonly that you’ll want to use strongly-typed HTML helpers such as Html.TextBoxFor from within a shape’s template. Unfortunately, this is not possible: those helpers rely fundamentally on the model being strongly-typed, because they need to be able to infer the properties of the object from the Lambda expression passed as a parameter of the helper, but the compiler will refuse to compile Lambda expressions on dynamic objects. As I understand it, this is because the compiler can’t infer enough information about the object at compile time. This is all regrettable but that’s how things are.

    Read more...

  • Asking questions is a skill

    If you’re going to get into any sort of technical job, you’re going to have to ask questions. A lot of questions. Unfortunately, too few people understand how to ask questions properly. Asking questions is a skill. It has to be learnt.

    Read more...

  • The Shift: how Orchard painlessly shifted to document storage, and how it’ll affect you

    We’ve known it all along. The storage for Orchard content items would be much more efficient using a document database than a relational one. Orchard content items are composed of parts that serialize naturally into infoset kinds of documents. Storing them as relational data like we’ve done so far was unnatural and requires the data for a single item to span multiple tables, related through 1-1 relationships. This means lots of joins in queries, and a great potential for Select N+1 problems.

    Read more...

  • Video: Orchard’s best kept recipes

    In this talk that I gave last June for Orchard Harvest in Amsterdam, I showed, in no particular order, my favorite Orchard features, tricks, and modules. Don’t expect a narrative in there, cause there isn’t one, but I’m hoping you’ll learn a thing or two.

    Read more...