I'm kinda stuck with using include with RavenDB Transformer. Let's say I have the following document classes:
public class Processor
{
public string Id { get; set; }
}
public class Job
{
public string Id { get; set; }
public string ProcessorId { get; set; }
}
Here is my view model:
public class ProcessorStatsViewModel
{
public string Id { get; set; }
public int JobCount { get; set; }
}
In my tranformer, I would like to request a processor document repository and include in the Job Store a search in search of each job with a suitable processor identifier. All the search results that I found describe how to do this when the Processor class has a JobId list. Is there any way to do this in RavenDB?
The transformer I would like could look something like this:
public Processors_StatsViewModel()
{
TransformerResults = procs =>
from p in procs
let jobs = Include<Jobs>(p.Id)
select new
{
p.Id
JobCount = jobs.Count
}
}
All Transformer LoadDocument, Include, and Recurse methods expect the requested class to have a list reference identifier, but in my case it needs the opposite.
Is this something I can do even in RavenDB, or am I missing something?