Existing codebase - some advice please!

Topics: Customizing Orchard, General
Jul 25, 2011 at 11:29 PM
Edited Jul 25, 2011 at 11:34 PM

Hi folks,

We're considering Orchard to replace the web front-end of a fairly sizeable existing codebase that also contains a couple of Azure worker roles and REST services. These all talk to our own database using NHibernate 3.1. In addition we make extensive use of NInject as our IoC container.

I'm aware that Orchard makes use of Autofac and NHibernate 2.1 so I can forsee that we're likely to come across difficulties in integrating it into our existing code. Any recommendations on how we should proceed? Can we write modules that use our existing database, data access and IoC mechanisms? Likelihood is that we gut our existing website and start fresh with Orchard, but the existing data layer and other bits absolutely has to stay as they're used extensively by other parts of the code!

Thanks in advance for any advice/feedback!

Dean Ward

Jul 26, 2011 at 12:02 AM

In principle, Orchard choices should not affect you too much. Database operations can be isolated from the ambient Orchard transaction easily. The IoC part I don't see how there would be problems as long as you don't attempt to mix the two. The part that I can see being problematic is the nHib version. I don't know when you plan to finish that project, but you may have to wait until 2.0 so that the version of Orchard that you use has caught up with the version of nHib that you use. Unless of course you're willing to separate rather drastically the existing code from the Orchard code.

Jul 29, 2011 at 1:50 PM

Great, thanks Bertrand. How are module binaries currently dealt with? Are they loaded from the bin directory in the relevant module area? If that's the case, presumably I can reference the NH 3.1 DLL in our module and assembly versioning should (hopefully) take care of the rest (given that NH 2.1 is already in the bin directory of the main web project)...

I'll give it a shot and see where we get.

I have one more question around integrating with some of our existing bits. We're likely to want to use Orchard's built-in comments and tags, but I need to be able to expose these from our REST API - probably read-only but possibly read/write in the future. What's the best way of approaching this?



Jul 29, 2011 at 9:15 PM

No, modules are dynamically compiled by the application (see http://orchardproject.net/docs/Orchard-module-loader-and-dynamic-compilation.ashx).

Exposing anything as a REST API should be super-easy, by adding your own route and controller for that. Anything that the original controller and drivers can do, you can too.