Recent Posts and Articles
In a previous post, I discussed how to create and work with a CMS web site using WebMatrix. In this post, we will discuss how to deploy the website to a hosting account.
It probably makes sense that my first official blog post for my fresh start is on Orchard CMS since I currently spend a big portion of my day developing Orchard Websites, Orchard Modules, and Orchard Themes. This particular post is based on my own experience with the new Autoroute Part and Alias in Orchard 1.4 as well as a question I received from a client today. My client was changing the permalinks on published content items in his Orchard Website and noticed the website was still responding to the old permalinks. His question was fair - how do I remove the old permalinks from the Orchard Website?
Although Autofac is not really part of Orchard's public API, it does come in handy when you need to customize how some of your classes are created and managed by Autofac.
In general, when you write your own classes that are injectable, you would take the following steps:
- Define an interface that derives from IDependency;
- Define a class that implements your interface
However, in certain cases, you may want to inject concrete classes directly into your constructor instead of an interface. One example might be when you implement the Command Pattern. You would generally have multiple classes that ultimately implement some ICommand interface. Next, consider having a controller that has a dependency on some command, e.g. SaveCustomerCommand. One solution could be to create a specific interface for each command, which would be perfectly fine (and perhaps even preferrable for unit testing classes that depend on these commands). But let's say that for some reason you don't want to write these interfaces. How would you be able to inject an UpdateCustomerCommand or a SaveCustomerCommand?
The answer is to tell Autofac about it!
Once again i had been teaching about Orchard in a workshop. It all run very well and this framework still inspire people. Off course all the orchard board knows that there is a long path to go until we reach the maturity of a complete CMS framework.
When developing modular application services, there are times that you want to raise an event that other code can act upon. For example, consider having an IOrderManager that creates new orders. When a new order is created, some other code (perhaps even in a different module), like an OrderHandler, may want to act upon that event and start the shipping procedure. In our example, the IOrderManager would be a publisher of events, and the OrderHandler one of potentially many subscribers.
Two of the greatest advantages of such a setup is decoupling and extensibility. Orchard uses this approach almost everywhere: when a new user registers, when publishing, deleting, importing, exporting content items, when sending a message via the message service, when rendering shapes. The list goes on.
So how could we implement a pub / sub pattern in our own module? As it turns out, it's quite easy...
This series is my attempt at charting and documenting Orchards's most useful concepts, services and features as I come accross them during real world development.
And maybe at some point, we may have a thorough reference to Orchard development and all of its rich set of API's, features and concepts.
For a new project I'm working on, I needed to override the title that is displayed in the Content Items overview in the dashboard. This overview lists all content items, and by default, displays either the name of the content type, or, if you attached a TitlePart to your content type, the title of that TitlePart.
In my case, I have a Client content type that has a FirstName and a LastName property, that I would like to display as the title.