Aug 9, 2015 at 1:03 PM
Edited Aug 9, 2015 at 1:03 PM
In the migration class, I would like to add some content (images) to the media library/folder, e.g. standard car manufactor logos that should be provided by the module.
Additionally, the logos should reside in a subfolder.
I try to figure out how to accomplish this.
My first try is this (maybe this is a completely wrong way):
I found that there is an IContentManager
interface, but I do get a NullReferenceException
when calling the
method (the _contentManager itself references to a DefaultContentManager
var contentItem = _contentManager.New("Manufactor");
The NullReferenceException is caused by an empty httpContext
parameter in WorkContextAccessor.cs:88 of Orchard 1.9.1:
httpContext.Items[workContextKey] = _workContext;
After debugging into the framework, it seems that this line should provide the context: (MvcModule.cs:56 of Orchard 1.9.1):
var httpContextBase = context.Resolve<IHttpContextAccessor>().Current();
Any idea what I am doing wrong?