Recent Posts and Articles
On the second day of Orchard Harvest one of the hackathon groups explored the idea of using graph databases, specifically Neo4j, in Orchard. I followed up on the topic and researched on how graph databases can play along in an Orchard module.
You can see the progress from the discussion I've opened. I've searched for .NET graph databases but couldn't really find any up-to-date project, even .NET drivers for graph databases are scarce. Neo4j seemed indeed like the best way to explore further: it's a very popular graph database and exposes a RESTful API so other pieces of software can use it even when they don't run on Java like the Neo4j itself. Fortunately Tatham Oddie and his team developed Neo4jClient, a .NET wrapper that provides a nice interface to interact with Neo4j through its web services.
It turns out that using Neo4jClient from Orchard is quite simple.
There are a number of ways to do this (as with most things Orchard!) but one way that we’ve found that is both easy and very useful is to store the value in the WorkContext.Layout. Because it’s dynamic you can add your own property and access it from anywhere else.
Imagine that you have a Customer which in turn has two Addresses: ShippingAddress and BillingAddress. These addresses or content items, just like the customer is.
Next, you want to create a content part editor where the user can edit the Customer fields as well as the fields of the two addresses.
Furthermore, the Address has a Country navigation property, where Country is a simple entity class, not a content item.
We want to enable the user to pick one of the available countries using a dropdown list.
LazyField<T> is a utility class that lives in the Orchard.ContentManagement.Utilities namespace and enables you to return a value in a lazy manner.
You may remember from part 1 we set the scene and also got code gen working and the correct zones are all on and we are ready to go. But before I go into the next part, I wanted to explain my set up as that maybe pretty important to people out there.
I have been asked by my bro in law to write his comenius site which is a bunch of connected schools that show of their childrens work. The requirement is we have a home page which has a bunch of landing pages for different countries who then show off their work for the kids. Sounds great, lets see if we can knock that up in orchard so admins of particular countries can only edit their content and i'm gonna throw a spanner in the works as I also want this to look nice on a mobile device as well as the desktop, so responsive design and mobile first are the order of the day.
As you may or may not yet know, Orchard source code repository has recently undergone slight refactoring. Namely - subrepositories for core modules are no more! It's really happy news for all of us working with Orchard source on daily basis - it means saving a lot of time when doing source code pulls and pushes.
If you've ever tried working with couple of Orchard forks sitting as subrepos in some bigger repository you should know what I mean. And if you haven't – believe me – waiting tens of minutes for your push to go through (if everything goes well, of course) can drive you nuts! Especially when e.g. your colleague did a push at the same time and you end up having to merge his changes and… losing another 15 minutes for pushing your merge in. Aaaargh!
That being said – it's awesome we don't have those nasty subrepos now and everything sits in a single repo. But unfortunately, Mercurial does not like it as much as we do... Removing a subrepository in one changeset and then re-adding files in exactly the same path, but committed to the main repo instead, will prevent you from performing update between changesets from before and after subrepo removal.
I have a question I want to ask in the Orchard Forums today. I still haven't asked it as of this blog post, because I got sidetracked on two things. First, anytime I plan to ask a question on the Orchard Forums I like to answer at least 1 question if possible. This is just being a good neighbor and I encourage others to do it. If you are planning on asking a question in any forum, pay it forward and answer a question first. Second, as I was reviewing the forum questions, I thought of some forum best practices that I thought would be valuable to the community. This led me to this blog post.