SaaS CMS has officially launched! Learn more now.

Extending Unified File



I want to extend/inherit from the UnifiedFile class to add some extra properties and encapsulate the functionality in my project

However upon doing so e.g.

ImageItem : UnifiedFile

I get the error no constructor exists with 0 arguments. I do not really need all the extraneous info associated with the default constructor is there a way round using it?

Has anyone implemented something similiar and has some advice?

Thanks a lot


Nov 11, 2008 12:39

Hi Ian,

I'm not sure that inheriting from UnifiedFile is such a good idea.  The problem is that none of the methods in EPiServer are going to give you back an instance of an ImageItem, so even if you construct a UnifiedFile object you'll be unable to get it back unless you explicitly construct a new ImageItem and initialize it with the data from the UnifiedFile returned from EPiServer.

I'd suggest instead creating a wrapper class for UnifiedFile, like this:

public class ImageItem


public UnifiedFile UFile { get; private set; }

public ImageItem(UnifiedFile file)
UFile = file;

#region Utility Methods that operate on UFile, specific to ImageItem


Then you can easily turn any UnifiedFile in to an ImageItem. 

Hope this is useful.




Edited, Nov 11, 2008 12:56

Hi Andy,

I was imagining that might be the way to go.

Thanks for the confirmation



Nov 11, 2008 17:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.