Subscribe: Tales from the Evil Empire
Added By: Feedage Forager Feedage Grade B rated
Language: English
allowfullscreen allowfullscreen  allowfullscreen  code  content  element  harvest  net  new  orchard harvest  orchard  search  site 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Tales from the Evil Empire

Tales from the Evil Empire

Bertrand Le Roy's blog


Unimportant egocentric rant: don’t .ToUpper() your titles

Sat, 09 Apr 2016 16:23:00 GMT

Here’s a minor inconvenience that I’m going to put out there in the hope that one or two of the horrible people responsible for it may realize the errors of their ways and make the world a marginally better place.

So you like your titles to be all caps. Fine. I’m not sure why you insist on screaming like that, but that’s your choice, and it’s your web site/blog. If you are going to do this, however, please don’t do this:


And not just because you neglected to specify a culture (you monster). No, this is wrong because next time the guy who builds the week in .NET wants to mention your site and copies the title over, he’s going to copy this:


instead of this:

How to use Entity Framework to make a rainbow

He’s going to curse loudly, his kids may hear him, and they’ll grow up to become as obnoxious as he is, all because of you. Well done.

This is particularly infuriating because there is a perfectly good way to do this bad thing that you insist on doing. In your CSS, just do something like this:

h1 { text-transform: uppercase; }

There. Was that so hard?

Except that no. When you copy text that has been styled this way, you’ll still get the all caps text instead of the unstyled underlying text. F@$#!



Just don’t .ToUpper your titles. Please. It looks like crap and it’s less readable. And you sound like a Facebook comment from that uncle who ruins Thanksgiving every year.

On dependencies, dependency injection, and sanity

Thu, 24 Mar 2016 23:50:29 GMT

What's interesting about debacles such as the recent left-padding madness is how it can get you to re-think seemingly obvious concepts, and challenge some basic assumptions. Here's in particular a little reflection that just occurred to me on the way between the bathroom and my office, and that may seem super-obvious to some of you. It wasn't to me, so here goes, I'm sharing…

Whether you go all theoretical, call it fancy and talk about "inversion of control", or you just pragmatically do constructor injection like God intended, at this point almost everyone agrees that dependency injection is a Good Idea. You inject a contract, and the black magic inside your IoC container finds the right implementation and gives you an instance, with the right scope, lifetime, etc. Coupling is low, applications are more robust, more modular, more flexible, and unicorns flutter around happily.

Now when you look at the wonderful world of package managers (a clear progress over what the hell we thought we were doing before), what are we doing exactly? Well, we need a component that performs a certain task (in other words, it fulfils a specific contract). We then go on to ask The One True Package Manager to hand us a very specific version of a very specific package. And we do so USING A STRONG NAME. Pardon me for screaming, but can you see the parallel here?

We are "injecting" a "dependency" into our application, but it doesn't for one second occur to us that the concept is almost exactly the same. Let's go over the comparison one more time.

Dependency Injection "dependency" "injection"
Ask for a contract Ask for a strong and versioned package name
Get a managed and scoped instance with members that you can call into Get a set of namespaces with stuff in them that you can call into

So what is good practice on one side (resolution by contract) is completely out of the picture on the other. Why can't we ask for packages by contract? I don't know exactly what that would be looking like, but I have the nagging feeling that there's something to invent here. Or does something like that exist? What do you think?

Easy custom RSS in Orchard

Fri, 26 Feb 2016 20:15:56 GMT

Orchard adds RSS automatically to everything that looks like a list of content items: blog posts, of course, but also comments, projections, lists, search results, tags, etc. I’ve explained before how RSS works internally, but adding a new feed from code can look like a daunting task if you’re not an experienced Orchard developer. Fortunately, there is another feature related to RSS that makes it possible to create custom RSS without writing a line of code. On a default installation of Orchard, let's create a new query that lists all pages in the system (that would be just the home page unless you created more): Then, let's use that in a new projection page: Once this is done, we can navigate to the new projection, and if we look at the rendered HTML, we'll see the following tag in the HEAD that gives us the path to the RSS feed for the query (ID may vary): If we follow that URL, we'll find the default RSS feed: Pages http://localhost:30321/OrchardLocal/pages Pages Welcome to Orchard! http://localhost:30321/OrchardLocal/ Welcome to Orchard! Fri, 26 Feb 2016 16:19:26 GMT http://localhost:30321/OrchardLocal/ If we want to customize this feed, say we want to add taxonomy terms as RSS categories, it is actually possible to do so just from the admin. I'll assume that we have a taxonomy called "Category" in the system, and that we've added the corresponding taxonomy field to the type definition for Page. First, we need to enable the Feeds Tokens feature: Let's head over to the content definition for the Page type and add the RSS part: Now we can configure the part to use our taxonomy as RSS categories: And voilà, our feed now shows categories: Welcome to Orchard! http://localhost:30321/OrchardLocal/ Welcome to Orchard! Fri, 26 Feb 2016 16:19:00 GMT http://localhost:30321/OrchardLocal/ Home Orchard RSS [...]

Why I prefer spaces to tabs

Wed, 20 Jan 2016 23:46:00 GMT

Coding convention discussions are always fun. I just had one of them on the weekly Orchard meeting, where I’ve joked that spaces are objectively superior to tabs, by which I meant that there are objective arguments in favor of spaces that I find subjectively compelling..

The first argument for me is that a good programming font has to be a monospace font. Tabs are weird in that context because they are the only useful characters that are a different width than everything else. If, for whatever reason, you have to replace a space with another character, nothing else will move. If you replace a tab with anything else, the rest of the line will move. Additionally, if you change the tab width in your editor settings, the code will look different to you than to its author.

The second argument is that what you align is not always line beginnings. There are legitimate cases where the beginning of a line is aligned with some boundary inside the previous line. A typical example is a list of arguments for a method that is too long to fit on one line:

It is a legitimate preference to want the additional lines of parameters to align with the opening parenthesis. Tabs can’t do that consistently.

That’s my opinion. Pick your own. As always, what’s important is to set the rules for the project and stick to them…

Liberté, Égalité, Fraternité

Sat, 14 Nov 2015 17:36:00 GMT

They hate joy.

They hate freedom.

They hate peace.

They hate life.

They hate what we are: joyful, free, peaceful, and alive.

So they scream, they enslave, they wage war, and they kill.

They can kill us, but they won’t kill joy, freedom, peace, or life.

We’re stronger.

We stand together.

We are the Human Family.

Open Source is about much more than code contributions

Sat, 31 Oct 2015 17:15:36 GMT

Tell the pointy-haired bosses around the world: putting a GPL sticker on your product is not going to magically make all those nerds in their parent’s basements build it for you, and for free. Nope. Not going to happen. And you know what? The code contributions are not the benefits you’re looking for…

Just to get this out of the way, not all businesses should make their software open source. There are plenty of sensible reasons to keep your code closed (most of which would probably make me look for a different job, but that’s another story). Way worse than keeping your source proprietary however is to open it for the wrong reasons: it’s going to fail, and going back to closed is hard and damaging.

Community really is what you’re looking for, and making your product hackable is the best way to build that. And what better way to make your product hackable than to open it with the most liberal license you can find?

Community means the most loyal customer base you can hope for. Better, it means advocates for your products. Ask Tesla (a pioneer in open hardware in a very conservative industry): here’s a company that has disrupted the car business, without any advertising whatsoever. How? Community: the best Tesla salespeople are Tesla owners. How do you recognize a Tesla owner? You don’t have to, he will fucking tell you. And he’ll give you a ride. And then you’ll want one. So yes, you also need a freaking good product.

The community can help you with that as well, in fact: casual users aren’t going to tell you what sucks in your stuff, they’re just going to move to the competition. Deeply invested, passionate contributors will, because they need and want it to get better.

Building a passionate community is the stuff of dreams for business people, and it’s a very difficult thing to build. But here’s the catch: community is a two-way street. It works much better if it’s not based on a feudal system where the lord in the castle orders the serfs what to do. Nobody’s going to willingly stay in such a community, you’d need a way to coerce them to (not naming names, no sir), and that’s evil, m’kay? No, a healthy community, like a successful marriage, is based on mutual respect and genuine interest in others’ differences, drives, and goals.

If you feel the urge to restrict what your users can do with your code or designs, if you think you should prevent potential competitors from emerging from your user base, then maybe open source is not for you. You should feel comfortable with letting contributors come up with their own reasons to fork your project. It might be to build something amazingly creative that you wouldn’t have thought of in a thousand years, or it might be a clone of your product. Big deal, out-innovate them, capitalize on the rest of the community: nobody wants to use the cheap clone that’s lagging two releases behind.

Here’s another wonderful consequence of the open model: it will help you look beyond myopic profiteering, and build a business model that is more human. It will make you think about what really matters, about why you’re doing whatever it is you’re doing. It will make your life better and more purposeful. True story.

Sprinkling some C#6 fairy dust on FluentPath

Thu, 15 Oct 2015 15:09:00 GMT

I moved my FluentPath library’s source code from CodePlex to GitHub, and while I was at it, I vacuumed a bit, removed the cobwebs, and decided to see what applying some C#6 goodness would do to my code. Usually, I would not advise anyone to touch existing, working code that way just for the sake of using the new features: if it ain’t broke… But I wanted to kick the tires, you know? Just don’t start sending people pull request with that sort of crap, that would just be rude ;)

There were a few places where I was able to replace String.Format with string interpolation, but those are not great examples because those strings should be localizable, ideally, something with which interpolation won’t help much.

The biggest benefit for this library really was using expression-bodied members wherever it made sense. For example, this:

public static T Root {
  get {
    return Create(System.IO.Path.GetPathRoot(Current.ToString()));

Can now be written this way:

public static T Root => Create(System.IO.Path.GetPathRoot(Current.ToString()));

Much terser and easier on the eyes, no?

You can check out the whole changesets here and here.

Orchard Harvest 2015 – Trip Report

Mon, 12 Oct 2015 15:28:00 GMT

It is customary when returning from a conference that we write a trip report and send it to the team. In the spirit of openness that surrounds all things Orchard, I’ve decided that I’d write the trip report for this year’s Orchard Harvest as a public blog post… So here it is… This year’s edition of the conference was the fourth Orchard conference. Harvest is a relatively small, single track conference, with about 60 attendees, and 12 sessions given by 11 speakers over two days. All the talks are professionally recorded, and make their way to YouTube a few weeks after the event. The conference alternates locations between the US and Europe. This year’s conference was held in Alicante, Spain. This was a very pleasant location, with clement weather, and lovely sunrises over the sea. Because the conference happened off-season, the city wasn’t crowded, and everything was very inexpensive. The nightlife in Alicante is what you’d expect from a Mediterranean city. The food is amazing, too. Tapas rule. This is important, because especially for smaller conferences, the main reason to go isn’t the sessions: it’s the networking. The audience for Harvest conferences is composed of core contributors, web agencies, and independent software vendors building on and for Orchard. It’s a crowd that is very personally invested in the success of the platform, wants to see it progress, and wants to exchange and collaborate. During one of my sessions, I asked who had chosen Orchard because it’s running on .NET, and almost everybody in the audience raised their hands, so this crowd is definitely not only attached to Orchard, but also to .NET and C# in general. This is a platform that they love, and that they want to work with it if they get to choose. The sessions made it clear that Orchard is now firmly in the hands of the community, not just by its open governance model, but also by contributions. Although it started as a Microsoft project, its future is now what the community will make of it. There was a question during the panel session about more Microsoft resources devoted to the project in the future (Sébastien Ros is working more or less full-time on Orchard), and more specifically if I would be spending some Microsoft time on it now that I’m back working for the Evil Empire. That was interesting in that at this point, it would really be a nice to have, and something that the community would really appreciate, without fear of unwanted intervention on governance. From this and various conversations I’ve had after the sessions, it seemed clear that the perception of Microsoft with regards to open source has really shifted from being slightly threatening and suspect, to being an appreciated contributor to the ecosystem. To be fair, Microsoft has never been a boogeyman to this particular community, but there seems to be no concerns whatsoever today about this. Let me know in comments if I’m misinterpreting that one. The sessions were all very interesting, and could be classified under three categories: Orchard features and extensions now and in the future, external topics of interest to Orchard users, and case studies. In the features and extensions category, we had: The CMS of the future, where Nick and I talked about the core principles that made Orchard successful as the CMS of the future of 5 years ago, and how those same principles still apply today as we are designing the CMS of today’s future, Orchard 2.0. VNext, where Nick followed up on the keynote to show exactly what Orchard 2.0 is shaping up to be. Layouts, where Sipke gave an in-depth look at the coolest new Orchard feature, which lets site administrators create richly laid-out contents from the admin dashboard. As often, extensibility is key. Forms, which could be considered the [...]

Orchard Harvest 2015 – ASP.NET MVC 6 Tag Helpers

Tue, 06 Oct 2015 13:59:00 GMT

Taylor Mullen was here to introduce the tag helpers that are going to be added to ASP.NET MVC 6, basically to replace HTML helpers. Tag helpers are html tag-like bits of C# code. Because they are essentially C#, you can get all the benefits of the IDE, such as IntelliSense and refactoring. Out of the box, there will be tag helpers for forms, labels, inputs, that understand additional attributes. For example,

Orchard Harvest 2015 – Orchard for tens of thousands of journalists

Tue, 06 Oct 2015 10:52:00 GMT

Lombiq gave us a case study of Media Kitty, which is a web site with 18,000 users. This is a rewrite of a web site that was previously written with VB and WebForms.

The new site features rich profiles including images, taxonomies, subscriptions, and billing/payment. The contents of the site is then restricted by permissions that depend on subscription levels. The site also has a social network aspect, where users can follow each other, like posts, post private messages, and invite others. Integration to external social networks is also provided.

Layouts and the media library are heavily used. A custom field was built to allow end-users to manage their own media.

They implemented some extensions to placement to enable grouping of shapes (think tabs, as one possible way to present that). It’s even possible to show the same shape under multiple groups. No numeric positioning under groups however.

This being a migration from an existing application, they had to migrate the legacy data, and operate the site, including during the migration.

One of the tools they have built is a way to use Orchard as a framework in an existing application, like VNext will enable, but on the current version. They use that to build a console application running Orchard code (NOT the command-line interface that comes with Orchard).

They also showed some of the tools they have built to better manage Orchard instances on Azure.

They’ve built a module that allows for remote execution of recipes that they use from continuous integration (TeamCity) to trigger configuration changes on new builds.

UPDATE: the video is online.

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 - VNext

Tue, 06 Oct 2015 09:54:00 GMT

Nick Mayne is presenting this session on not the next minor version of Orchard, but the real, actual 2.0 that’s going to happen. One of the things we’re trying to access is the coupling of subsystems in the Orchard framework. Another is making it run on ASP.NET 5. To address those, a complete rewrite of the framework is in order.

The first goal is multi-tenancy, and the second is modularity. For multi-tenant routing, Nick created a new middleware. For modularity to work with multi-tenancy, he scoped services to either the tenant or the request. Building modularity, module loading, and associated build processes, based on the moving target that is ASP.NET 5 at the moment was very challenging.

Then new goals were added. CoreCLR is one, which will address cross-platform concerns: it runs on Linux and OSX. Another is the separation of storage and querying. The third is to break the framework down into its subsystems.

For storage,we shouldn’t need to care where contents is stored, just that we can retrieve it. He implemented an EF content store, but that’s an implementation detail that’s hidden under IContentStore, an async interface. You might as well have the content store, or a document database. Or all of the above.

For querying across content stores, there is a new abstraction called IContentStorageManager that provides indexing, querying, retrieval and access to storage. The base way to represent content is through a StorageDocument, which is an Id and a Data blob. The whole querying idea in VNext is map/reduce style indexing and querying.

When building a new Orchard application, you can now build your own host. This means that it is a lot easier to build applications that use bits and pieces of Orchard without having to necessarily buy into the whole approach. Orchard.Web becomes just one implementation of a host.

Nick showed some concrete implementations of hosts, middleware, and content stores.

He also showed how the framework is now broken into NuGet packages that are all optional. A lot less is hard-coded, including common conventions, so everything is a lot more flexible than it already was. When something, like the default host configuration, is expressed explicitly in code, it’s in an implementation of a contract that can easily be replaced.

The project is still small with 6 contributors, but it’s generating a lot of interest, justifiably so.

Challenges include sticking to the tip of DNX, and finding external packages that are CoreCLR-compliant.

UPDATE: the video is online.

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 – .NET Foundation, Future of .NET and C#

Tue, 06 Oct 2015 09:42:00 GMT

This was my second presentation for this Orchard Harvest, so I won’t be able to exactly live-blog it, but like yesterday, I can at least post the slides. The first third of the presentation was given by Martin Woodward from the .NET Foundation, then I presented on .NET Framework and Core, then on C#6 and C#7. Most of the C# slides were provided by Mads Torgersen, so thanks a lot to him for that. And without further ado, here are the slides...

width="595" height="485" style="margin-bottom: 5px; max-width: 100%; border: #ccc 1px solid;" marginheight="0" src="//" frameborder="0" marginwidth="0" scrolling="no" allowfullscreen="allowfullscreen">

UPDATE: the video is online.

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 – Forms

Tue, 06 Oct 2015 08:45:00 GMT

Dynamic forms are an application of the layouts feature that enables you to build richly laid-out forms, and handle their submission. Sipke, our speaker for this session, is the main developer of both features.

He started by creating a new content submission form, and going through the various options available. Then, he quickly moved on to dropping and configuring title and body fields and associated validation elements onto the design surface. He added a submit button, added the form to navigation, and published it.

A relatively unknown feature of the layout element that Sipke pointed out is keyboard shortcut support to move elements around, with support for cut & paste. This should help with the feature’s accessibility.

Once the form has been published, it is available on the front-end, allowing for end user content submission.

The submitted contents get added to the corresponding list of submissions that is accessible to the site administrators. In order to make things a little more useful, Sipke showed how to use the “create content” option of dynamic forms. In order to make it work, he had to go into the bindings tab of each form field and define what part of the target content type (blog post in the demo) the field should get mapped to.

Because he chose to create blog posts, and blog posts must be contained in a blog, he had to add a new workflow that reacts to the creation of a blog post with a custom activity that can set the container blog.

Once this was done, he was able to create a blog post from the front-end. Of course, in reality, you’d add some validation steps to that workflow, but this is already quite compelling.

Sipke then added a third field to the form for tags, bound to the blog post tags part. To support autocomplete on that new field, he showed how a custom element can easily be implemented to provide a good front-end experience: the blog post editor in the admin dashboard has a user experience that doesn’t immediately translate to the custom form, but it’s relatively easy to create the elements that you’d need to recreate it.

UPDATE: the video is online.

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 – Keynote: The CMS of the future

Mon, 05 Oct 2015 21:58:00 GMT

Yes, well, if you feel that I haven’t blogged enough today, this post is for you. There is one session that I missed in that frantic blogfest, and for good reason: I was giving it, with my friends Nick and Sébastien. I won’t detail the contents of what we said (you’ll have to wait for the video to make it to YouTube, sorry), but I can definitely share our slides. So here goes… Enjoy…

width="595" height="485" style="margin-bottom: 5px; max-width: 100%; border: #ccc 1px solid;" marginheight="0" src="//" frameborder="0" marginwidth="0" scrolling="no" allowfullscreen="allowfullscreen">

UPDATE: the videos are online:

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen"> width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 – Case study: the NFLPA web site

Mon, 05 Oct 2015 15:15:00 GMT

The NFL Player Association web site is a migration from a WebForms application. The team wanted a WordPress-like CMS, but running on .NET. They ruled out SharePoint and Umbraco, and went for Orchard because of its dashboard (that was 1.8 at the time). They chose to deploy on Azure.

The previous version had a mobile and a desktop version, which was a problem as most of their traffic was going through the downgraded mobile experience. They replaced it with a single responsive Bootstrap theme.

The site is using Active Directory for membership and authentication of staff accounts, while non-staff accounts are in Orchard, with a complex custom process associated with the transition between the two types of accounts.

The Orchard application plus their CRM, are replacing four different applications.

Azure web applications enabled them to scale much faster when high profile press releases hit the site than with the previous cloud services setup. With Azure Redis caching in place, they can scale up if they need to, but never had to so far. Being able to do partial deployments of modules was also a big improvement over having to deploy the whole role every time. Caching also became a lot easier, with less issues.

They are using ElasticSearch to log and analyze the site’s activity. Reports are presented through a Telerik reporting UI.

They have been using TFS for bug reports and source control, but would use Git instead if they started today, if only to simplify merges when upgrading Orchard.

The migration was done in nine months.

One of the problems they are trying to solve is to enable caching for authenticated users. They are now working on single sign-on and user dashboards.

UPDATE: the video is online.

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 – Search API

Mon, 05 Oct 2015 14:26:00 GMT

In which we learn how much of a narcissist Sébastien really is: he watches his own sessions from previous years, and learns a lot doing so ;)

Search in Orchard is implemented through three modules:

  • Orchard.Indexing detects changes from content handlers, processes changes in a background task, and configures indexes in the dashboard.
  • Lucene implements indexed contents and search over the Lucene library.
  • Orchard.Search displays search results on the front end and in the dashboard.

In Orchard.Search, there is a recipe that sets up an index on all pages and blog posts in the site. It’s a quick and easy way to setup search on your site. The other way of doing this is to manually create an index from the dashboard and then configure search to use it.

Search can also be configured to display items in search results using a different display type than the default “Summary”. This makes it possible to completely customize the rendering of search results by using the corresponding alternate template.

It is possible to create a separate index to use with search from the dashboard. This is useful if the front-end has unpublished contents that should not be shown on the front-end, but should absolutely be found when searching from the dashboard.

Creating separate indexes can also be useful if you want to implement targeted search, for example a knowledge base search that is different from a product search.

If you want to implement custom indexing of contents from code, you can create a handler and call OnIndexing with a Lambda that defines how to index a given part. This is how the TermsPart in taxonomies can index taxonomy terms. This is also how the body part gets sanitized to remove HTML tag markup before indexing. is an application that reads Lucene indexes. This is a nice way to check if and how an index was built.

ISearchService lets you perform searches on an Orchard index from code, while IIndexProvider lets you implement custom indexes instead of Lucene.

Sébastien showed how to create a custom search API controller that queries the index, applies some faceted filters and custom order, then outputs the results as a JSON document. The faceted search is done using GetBits on the search builder. You can ask the result of that for the number of results that match any particular value for the facet. This is how implemented its faceted search.

Finally, Seb showed how to do geolocated searches, which I had no idea Lucene could do. But of course you can, as long as you have coordinates: just check each index entry from your search builder for the distance with the point you are trying to filter around.

All these custom filters are being applied against the index, rather than the actual database, so it’s all very fast. This is in fact fairly close to the map/reduce APIs that are available in DecentCMS and the Orchard 2.0 prototypes.

And… the jetlag is finally kicking in. Unless it’s Sébastien who made me so sleepy. This blog post was written while sleeping, so if you spot any glaring inaccuracies, let’s blame it on that.

UPDATE: the video is online.

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 – Layouts

Mon, 05 Oct 2015 11:31:00 GMT

Sipke made a new demo of Orchard Layouts, which have in my opinion dethroned workflows (and taxonomies before that) as Orchard’s crown jewel. He started by showing simple layout elements such as HTML and Markdown, then quickly switched into Orchardy extension and reusability mode.

He started from a simple Bootstrap theme, then added a single Razor file in an Elements directory to add a jumbotron snippet element.

Then he showed how you can create a preconfigured element from an existing element, and re-use that throughout your site’s layouts.

He also showed how to save a layout as a reusable master layout. He put a logo, and two columns in there. He used that to show the new widget harvester that enables one to drag and drop widgets onto layouts. Another new feature is element visibility rules that can be used to hide and show elements based on custom rules, much like what we already have on widget layers.

Layouts come with a default grid system, so they can work without specific theme support, but if you’re using Bootstrap, it’s useful to be able to replace that default grid with the Bootstrap grid. Sipke showed how to do that by overriding element templates in the theme.

It’s also possible to re-use content parts as elements in layouts. You’ll need to suppress the part’s shape in to do that without having the part show twice.

With the shape element, you can add any shape to your layouts, which works especially well in conjunction with the Razor shape editor feature.

Sipke then built a configurable custom element that shows an inbox badge. This is done by deriving from Element, and implementing an element driver that uses the forms API to create the editor. He then wrapped his new element, using the element wrapper part, to create a new widget type that re-uses the element. This bridges the gap between elements and content parts in the case where you want to only implement the element, but still be able to use it as a part. Another place where you can now re-use elements is tokens: there is now an element wrapper token that you can use to render an element in place wherever tokens are accepted.

To conclude, Sipke mentioned the future of the layouts feature. He mentioned how we might want to unify widgets and layouts, but currently we’re missing the equivalent of layers in the element world. Sipke’s company, IDeliverable, is also working on a new version of the layout editor, Ayos, that improves on the current one by doing away with grid and row elements, making for a much simpler editing experience. The new editor is also CMS-independent, and could be reused on other applications.

UPDATE: video is online.

width="560" height="315" src="" frameborder="0" allowfullscreen="allowfullscreen">

Orchard Harvest 2015 – Orchard Telemetry with Glimpse

Mon, 05 Oct 2015 10:48:00 GMT

Bede Gaming is an online casino gaming company that is built entirely on Orchard. As such, they need to be able to debug a lot of Orchard code as fast as possible. For that, they use Glimpse a lot. Glimpse is a Firebug-like tool for debugging server code. Out of the box, Glimpse gives you is a timeline, that looks like the network tab in browser developer tools. This is extremely useful to see where time is being spent. Think of it as lightweight profiling. The execution tab does more profiling by showing all method calls, with their aggregated execution times. The routes tab shows what routes exist on the system, and which one was selected and why. The SQL tab shows all the SQL queries being executed, which is extremely useful in Orchard (it does most of what mini-profiler can do). The trace tab allows you to see log entries corresponding to the current request. Glimpse is an extensible platform however, and it’s easy to add more Orchard-specific tabs. In his demo, Chris showed how to build a “cache service” tab that shows cache hits and misses, and integrates into the base timeline tab. Chris Payne built a couple of interesting interfaces to facilitate Glimpse integration: IGlimpseService, and IDecorator<>. IDecorator is generally useful and should definitely make its way into Orchard. It’s a way to decorate a service with additional behavior instead of suppressing dependencies and then calling a specific implementation. It includes the decorated service as an injected dependency, which makes it possible to add behavior and call into the decorated implementation without having to know what exactly it is. How did we not think of that? With IDecorator, Chris was able to decorate ICacheService and make it publish Glimpse messages every time the caching API gets hit. What I really like about this approach is that Chris built the right abstractions, so that it is easy for Orchard developers to add their own debugging and diagnostics information into Glimpse with just a few lines of code. This is very Orchardy, even more so probably than our old diagnostics tools, which really are a fixed set of features. I can see how unifying the current debug console and Glimpse would make a lot of sense, refactoring everything as Glimpse tabs. This is something we’ve talked about before, but never did. This talk is giving a really good incentive, and a set of tools, to achieve it. There will be a lot of benefits, not the least of which being that the Glimpse shell is much better polished than our own. Other tabs that they’ve built include a content management tab that shows the content items involved in building the current page, a shape tab that shows shapes and alternates, and layer and widgets tabs that show the layers and widgets that are currently active or not. They have also built custom tabs that show information specific to their business, such as an external API request tab. Almost all custom tabs have a very handy “edit” link next to each content item that appears in the tabs, and that takes you directly to the editor. Chris showed how using his Glimpse tooling, he discovered and fixed a SELECT N+1 issue in the Orchard widget and layers code. His pull request was accepted live, during the session, which is pretty impressive. This emphasizes how better tooling directly leads to better code. They are aggregating the data gathered into NewRelic to generate reports that clearly show where to focus to improve performance. And this is all available on GitHub: look for his branches under[...]

Orchard Harvest 2015 – Theming at Onestop

Mon, 05 Oct 2015 09:04:58 GMT

Onestop has been using Orchard for a few years now, and it’s one of the largest players in the community. They are delivering a complete e-commerce stack that is largely built on Orchard. And when I talk about a stack, this even includes product photoshoots and shipping from a huge warehouse in Los Angeles. They just handle everything end-to-end.

Their session at Harvest this year is about theming. Last year, they talked about using master themes, and interestingly that wasn’t such a great idea. In particular, too much code ended up in the themes, and it created coupling between sites that made the whole system brittle. Updating is more difficult, and sites can easily break each other.

In 2015, they revolutionized their approach, and took some inspiration from the auto industry, that has been changing from building car models to modular platforms that are assembled on automated assembly lines. That industry has a spectrum of processes, from fully-automated building of cheap cars, to luxury, hand-assembled Rolls Royces. Onestop has a similar spectrum of sites, the ends of which they call “Avalon”, sites that can launch in 6 weeks, and “Phantom”, the hand-built, heavily custom luxury sites.

For the Avalon sites, they put the product and creative teams together to create baseline wireframes. The themes for this have few files, and are semantic and responsive. They have defined two categories of shapes: actor and carrier. Actors shapes contain business logic, and should never be site-specific or overridden in a theme. Carrier shapes are structural and are expected to be overridden in themes. The sites have a subset of functionality, with the goal of reducing maintenance time and cost. In the end, their themes got from up to 90 overrides down to less than 20.

The Phantom sites on the other hand have more options, can modify modules, and as a consequence are more expensive to maintain. The shapes are broken down into smaller units, to enable more finely grained overrides.

They built and use a resource builder module that builds LESS files and bundles resources. This makes development of themes easier, more scalable, and performs better at runtime. Interestingly, module-level CSS can pick up variables defined at the theme level, which minimizes the number of overrides you have to make in the theme.

With all that work, they can launch sites in 4-6 weeks, QA has more time, and their partners love it. Sites launch with a tolerance of 10 bugs or less (none in the purchase path). They took maintenance cycles into account when designing the new platform, and that is probably something everybody should do.

Disclosure: Onestop has been a customer of mine for a few years, before I came back to work at Microsoft.

Orchard Harvest is happening October 5-6 in beautiful Alicante, Spain

Fri, 18 Sep 2015 19:23:00 GMT

The fourth Harvest conference, where the Orchard CMS community gathers to share experiences, talk about the future of the platform, and generally have a great time together, is happening October 5-6 in Alicante. We have a fantastic line-up of speakers, if I may say so myself, including the following fine people from Microsoft: Sébastien Ros, lead developer and Benevolent Dictator of Orchard, and N. Taylor Mullen, developer extraordinaire and super-fun speaker.

I’ll be giving the keynote with Sébastien Ros and Nicholas Mayne, on the topic of “The CMS of the Future”. This should hopefully be an insightful journey into how Orchard came to be, and where it’s going.

The second session I’m giving is about the .NET roadmap, C#, and the .NET Foundation.

Finally, I’ll be on the Q&A panel, which is always an enjoyable conversation.

I’m really looking forward to this. The Orchard community is super-welcoming, and I’m lucky to have made some great friends within it. If you are using Orchard, please consider attending. It’s going to be lots of fun, I promise.