Thursday, January 27, 2011

Separating your code from Ektrons’

Similar to my last post, this post is about creating a DLL which will access the Ektron repository. However, this time the DLL will be included as a reference in the website. This allows you to separate out your logic code from the presentation layer.

(Initially, I thought I would be restricted to using the Webservice API. However, as the DLL will be run within the context of the Ektron site, you are able to use the framework and controls).


  1. Add a new code project project to your Ektron site solution
  2. Add the following references to the code, by browsing to /Path/To/Site/bin-
    1. Ektron.Cms.Common
    2. Ektron.Cms.Framework
    3. Ektron.Cms.ObjectFactory
  3. Add your new project as a reference to the Ektron website.


The advantages of this are-

  • Re-usability – you can create a helper function DLL of common actions, which can be dropped into new projects
  • Testability – You can write and run tests directly against your DLL using nUnit Test Runner or similar. Ektron objects won’t be available, but can be mocked.
  • Reduces JIT-compilation load, though this can be mitigated by pre-compilation. However, this in turn is trumped by the fact that the Ektron workarea does not currently compile (high hopes are held for version 8.5)


In the end, I returned to putting all my logic code back in App_Code. The main reason was the tight deadline which was not allowing me the time to get past a couple of problems, namely-

  • Permissions issue on Logic.DLL. Visual Studio was unable to automatically update the DLL in the website, and i was forced to manually delete it from the bin folder.
  • Dev process is slower as Logic.DLL needs to be recompiled with every change.
  • Our standard helper functions have not yet been moved to a DLL, but have been used and tested in App_Code.

No comments:

Post a Comment