Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to inject a dependency into a GatheringNodeData handler and I can't seem to get it to work.
- As the dependency resolver isn't contructing this class, I can't just declare a constructor with an argument
- if i try and do this:
private void ExamineEvents_GatheringProductsIndexNodeData(object sender, IndexingNodeDataEventArgs e)
{
var queryService = DependencyResolver.Current.GetService<IQueryService>();
e.Fields.Add(Globals.Constants.Examine.ProductIndexFields.Content, queryService.ExecuteQuery(new ProductIndexContentSpecification(e.NodeId)));
}
The query service won't resolve. I think it's because this was done by using the examine manager in the developer section, so the request is via web api which uses a different resolver anyway.
Is there a way to get around this?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Injecting Dependencies into Event Handlers
I'm trying to inject a dependency into a GatheringNodeData handler and I can't seem to get it to work.
- As the dependency resolver isn't contructing this class, I can't just declare a constructor with an argument
- if i try and do this:
private void ExamineEvents_GatheringProductsIndexNodeData(object sender, IndexingNodeDataEventArgs e)
{
var queryService = DependencyResolver.Current.GetService<IQueryService>();
e.Fields.Add(Globals.Constants.Examine.ProductIndexFields.Content, queryService.ExecuteQuery(new ProductIndexContentSpecification(e.NodeId)));
}
The query service won't resolve. I think it's because this was done by using the examine manager in the developer section, so the request is via web api which uses a different resolver anyway.
Is there a way to get around this?
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.