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 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))]publicclassDefaultContentMediaResolver:ContentMediaResolver{///<summary>/// see http://getadigital.com/no/blogg/resolve-default-media-types-in-episerver////</summary>publicoverrideTypeGetFirstMatching(stringextension){varselectedAsDefault=base.GetFirstMatching(extension); //always null?// For all types inheriting MediaData, I want to use class GenericMedia as default not publicationif(typeof(MediaData).IsAssignableFrom(selectedAsDefault))returntypeof(GenericMedia);returnselectedAsDefault;}}
[ContentType( DisplayName="GenericMedia",GUID="47DA9013-68A0-4897-BBE7-C83A1F1A9BFD",Description="Used for generic file types such as Word or PDF documents.")] [MediaDescriptor(ExtensionString="pdf,doc,docx")] publicclassGenericMedia:MediaData,ISearchableContent {
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 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
Snippet
Snippet