November Happy Hour will be moved to Thursday December 5th.

Multiple MediaData media type.

Vote:
 
We have two media types (GenericMedia & Publication) which inherit media data and have a MediaDescriptor to associate the pdf,doc,docx extensions to both. When a user uploads a file via the asset manager its defaulting to publication but I want it to default to generic media

Ive used this blog post as the basis and would appear to do what I want but in my solution base.GetFirstMatching returns null. Any ideas why?


Snippet

[ServiceConfiguration(typeof(ContentMediaResolver)) ]
public class DefaultContentMediaResolver : ContentMediaResolver
{
/// <summary>
/// see http://getadigital.com/no/blogg/resolve-default-media-types-in-episerver/
/// </summary>
public override Type GetFirstMatching(string extension)
{
var selectedAsDefault = base.GetFirstMatching(extension); //always null?

// For all types inheriting MediaData, I want to use class GenericMedia as default not publication
if (typeof(MediaData).IsAssignableFrom(selectedAsDefault))
return typeof(GenericMedia);

return selectedAsDefault;
}
}
#172875
Dec 13, 2016 11:23
* 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.