0

Using Ektron v8.02, I've created a simple class library that makes use of the Ektron.Cms.Framework.Core.Content namespace.

I've added a console app to the solution to help with testing; to the console app I added a project reference to the original class library and an App.Config file with the appropriate Ektron.DbConnection connection string pointing to our dev Ektron database.

Briefly, here is the code in question:

Console app for testing

static void Main(string[] args) {
    MyClass instance = new MyClass();
}

Class library

public class MyClass {
    private Ektron.Cms.Framework.Core.Content.Content cAPI;

    public MyClass() {
        //** exception here **
        cAPI = new Ektron.Cms.Framework.Core.Content.Content();
    }
}

An exception is thrown in the MyClass constructor when I try to create a new instance of the Content API. The exception is an IncompatibleTypesException which says:

While resolving dependencies for Ektron.Cms.IRequestInfoProvider, the provided type is not compatible with Ektron.Cms.IRequestInfoProvider.

The Ektron Dev forums have a couple of threads here and here that mention this exact problem, but no solutions have been posted. Hoping someone with experience using the Framework API from a class library will recognize this situation and offer some advice before I have to call Ektron support.

kaveman
  • 4,339
  • 25
  • 44

3 Answers3

0

I think you're going to give yourself a lot of long coding hours and reference/gac nightmares trying to reference web libraries from a console app. I'm sure it can be done and I've had limited success with it myself. But when trying to call Ektron API's from a console app, I highly recommend creating some web services hosted in your ektron app that would do the heavy lifting with the API and then having your console app call the webservices. By doing this you can start threading requests and doing all sorts of automation processes.

Also when you upgrade (8.6 has a cool new editor) this will not cause any dependency issues and need to be recompiled. Their webservices are backwards compatible.

No code.. but hope this helps, let me know if I can clarify.

Andrew Eddy
  • 187
  • 7
  • Thanks for taking the time to reply Andrew. The only use I have for the Console app is for testing the class library (albeit there are better approaches I'm sure). The class library is meant to be one component in a larger set of web services, as you mention. Are you saying that this error is cropping up because I'm trying to test via a Console app? – kaveman Jul 25 '12 at 05:19
  • Yes, directly referencing assemblies from the console app, will generate errors. Ektron's API's rely heavily on objects that extend things like System.Web, HTMLGenericControl, etc.. all purposed for web apps/sites. It's my standpoint that when trying to run these types of tests, the Ektron api's reside in the web services, and the console app calls the services and returns whatever you need. It sounds like you're trying to do some automated testing? If that's the case I highly recommend Selenium. It works very well with Ektron and is what my team uses here (here=Ektron ;)). – Andrew Eddy Jul 25 '12 at 18:34
0

It is not that difficult. I had created a class similar to what you are talking about. My goal was actually to use this class library to import the content that I have from out in-house CMS.

But instead of using Ektron.Cms.Framework.Core.Content.Content() I was using Ektron.Cms.API.Content.Content().

May be you can give that a try.

Druid
  • 6,423
  • 4
  • 41
  • 56
Subrato M
  • 159
  • 1
  • 12
  • Thanks for the reply @Subrato. `Ektron.Cms.API.Content.Content` is part of the older API stack for Ektron, which we are trying to move away from. While it may technically work in this case, it's not the direction we are headed. – kaveman Aug 01 '12 at 21:06
0

This wasn't available with version 8.02, but the newer versions (v8.6+ I think) have an alternate "3-tier" set of dlls. These "3-tier" dlls use WCF to communicate with the workarea/database, so they have no dependency on web stuff like HttpContext. You can find the files in the installation directory; the path will be something like: C:\Program Files (x86)\Ektron\CMS400v86\startersites\3TierMin\Content

I've used these dlls with great success when writing console apps to do things like import or modify content. There are a few extra config files you'll need to bring along, and I think you need an AppSetting that points to the url of your "middle tier" -- the Ektron site that has your workarea.

Brian Oliver
  • 1,407
  • 2
  • 15
  • 25
  • Accepting because you point out something that should have been obvious to me at the time - 8.02 did not really support the Framework API. We've since upgraded to 8.61 and have also had great success with the Framework API/3-tier setup. – kaveman Jul 17 '13 at 18:04
  • @brian-oliver I am having similar issues , what kind of config files do i need to bring along. I got the necessary dll files but I think i need more than that – IndieTech Solutions Nov 07 '15 at 21:57