Beatles1692
Beatles1692

Reputation: 5330

How to set ResultsTransformer of an IndexQuery object

I am working on a RavenDB query on a type that is built in run time so I can't use generic methods like Query<>. I have to do this using DocumentStore.DatabaseCommands.Query something like this :

documentStore.DatabaseCommands.Query("Raven/DocumentsByEntityName", new IndexQuery{Query = "Tag : MyDocuments"},null);

So far so good unless this way I am getting Json objects and I want to transform them into another type.I realized that IndexQuery has a ResultsTransformer property but I don't know how to use it and couldn't find any documentation for this particular use of IndexQeury neither. So the question is how I can transform the results into another type?

Upvotes: 0

Views: 61

Answers (1)

Ayende Rahien
Ayende Rahien

Reputation: 22956

Set the ResultsTransformer property of the IndexQuery

UPDATE

To use ResultsTransformer property of IndexQuery one should create a ResultTransformer using AbstractResultTransformerCreationTask or DocumentStore.DatabaseCommand.PutTransformer (that accept a raw string to create a transformer) then he can set ResultsTransformer property of the IndexQuery to the name of this transformer.

Upvotes: 1

Related Questions