WhereEntityIs support

69 views
Skip to first unread message

The Bitland Prince

unread,
Nov 9, 2010, 12:09:16 PM11/9/10
to ravendb
Hello,

is anyone using WhereEntityIs to support more than one document type
in an index ?

I'm experiencing problems with that so I'd like to know if anyone is
successfully using it.

Thanks.

Ayende Rahien

unread,
Nov 10, 2010, 5:19:00 AM11/10/10
to rav...@googlegroups.com
Yes, it works, but there is a nasty trick there.

This will work:

store.DatabaseCommands.PutIndex("test", new IndexDefinition<object>()
{
    Map = docs => from i in docs.WhereEntityIs<Animal>("Cats", "Dogs")
                  select new {i.Color}
}.ToIndexDefinition(store.Conventions));


This will not:

store.DatabaseCommands.PutIndex("test", new IndexDefinition<Animal>()
{
    Map = docs => from i in docs.WhereEntityIs<Animal>("Cats", "Dogs")
                  select new {i.Color}
}.ToIndexDefinition(store.Conventions));

I am fixing this now

Khalid Abuhakmeh

unread,
Nov 10, 2010, 8:09:14 AM11/10/10
to ravendb
Could this also be the reason behind my own extension methods not
working, or is that a different issue?

Ayende Rahien

unread,
Nov 10, 2010, 8:16:18 AM11/10/10
to rav...@googlegroups.com
Unlikely, I am going to look at your stuff later today

Khalid Abuhakmeh

unread,
Nov 10, 2010, 8:38:04 AM11/10/10
to ravendb
thank you, i really appreciate it. I'd email you a beer if i could. :)

On Nov 10, 8:16 am, Ayende Rahien <aye...@ayende.com> wrote:
> Unlikely, I am going to look at your stuff later today
>

The Bitland Prince

unread,
Nov 10, 2010, 12:05:47 PM11/10/10
to ravendb
Confirmed. It is working now with changes you suggested.

It's very useful that objects will be returned with their original
class type. When you have syntax fixed, let me know :-)

Thank you for caring.
> > Thanks.- Nascondi testo citato
>
> - Mostra testo citato -
Reply all
Reply to author
Forward
0 new messages