Exception: Failed to load content type with name 'CategoryData' when working with Geta.EpiCategories plugin

Vote:
 

I've been struggling with an exception while I'm trying to import the package to one of the websites -

This has been due to the plugin installed - https://github.com/Geta/EpiCategories

So it's expecting a ContentType named 'CategoryData' which in my case I've two/category - 

 [ContentType]
    public class PressCategory : CategoryData
    {
    }

    [ContentType]
    public class GuestReportingCategory : CategoryData
    {
    }

And the block has a property that basically overrides the default Category of page/block

Any idea what may have happened?

#206461
Aug 21, 2019 17:45
Vote:
 

Hi Manoj,

You might want to create a hotfix around this issue like this not explained well on Geta's plugin document here - https://github.com/Geta/EpiCategories

So I can guess from the error you received above is that it is searching for a registered contentType "CategoryData" which it cannot find in the system.

So you can use the base class from EPiServer.Core.StandardContentBase that will do the rest for you. It'll will register CategoryData as a ContentType.

[ContentType]
public class CategoryData:StandardContentBase
{
}

However, If you look into the definition of inherited CategoryData base class (on your code) you will note that it exactly inherit the StandardContentBase but the keynote here is to decorate it with [ContentType] attribute. Which was missing in the original document.

Regards

Ravindra

#206480
Aug 22, 2019 10:05
Vote:
 

Bingo!

Hey Ravindra, You nailed it! Thanks for putting your efforts.

#206483
Aug 22, 2019 11:02
Vote:
 

I am glad to know that this helps

#206570
Aug 24, 2019 9:59
Vote:
 

Out of curiosity, did you import content into a site that doesn't have EpiCategories installed? If not, do you have a GUID specified (you always should) for your Category content types? I have never had these issues as long as content types match between exporting and importing site.

If EpiCategories was not installed on the target site, did you include content types in your export package? However, I don't see the point in exporting/importing content types between sites these days since they are defined in code.

#207141
Sep 11, 2019 10:55