Recent Posts and Articles
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.
The Orchard Project has already attracted the attention of many .NET professionals with close to a million downloads from their own site and others like CodePlex and Microsoft's own WebMatrix web site. So what is Orchard? It is an open-source, .NET based framework for building content heavy web sites. No longer will C# developers have to dive into PHP code, they will be able to utilize their C# coding skills and work within ASP.NET. From installation to live site this book will give you the details succinctly so that you can complete your projects on time!
Orchard CMS is an excellent content management system based on ASP.NET MVC. I absolutely love creating custom Orchard Themes and Modules for my clients. One particularly nice thing about Orchard is that although it can be very opinionated in the HTML it renders, it will get out of your way! This makes Orchard an absolute joy for creating custom themes for clients. Often these custom themes come in multiple styles / colors and the client wants to switch between those theme variations easily. As with all things in Orchard, this is easily done and I do it with my default theme in Orchard - Twitter Bootstrap.
The Twitter Bootstrap theme can be found here: http://gallery.orchardproject.net/List/Themes/Orchard.Theme.Bootstrap
WebMatrix is a free web development tool from Microsoft that includes everything you need for website development. Whether you are a hardcore developer or a novice developer, you can create a web application rather quickly and easily. Start from open source web applications, built-in web templates or just start writing code yourself. To begin, you can download and install it using Web Platform Installer. During the installation, a local web server IIS Express is also installed, which supports PHP applications.