tags:

views:

21

answers:

1

I am going through the RavenDB tutorial on the RavenDb.net website.
It was going fine until I got to the code block for creating an index.
This code segment is direct from RavenDB.Net website.

store.DatabaseCommands.PutIndex("OrdersContainingProduct", new IndexDefinition<Order>
{
    Map = orders => from order in orders
                    from line in order.OrderLines
                    select new { line.ProductId }
});

I get an error on compile: "The non-generic type 'Raven.Database.Indexing.IndexDefinition' cannot be used with type arguments."

If IndexDefinition is non-generic, why is it used as generic in the sample code? Where is the disconnect?

Thank you for your time Jim

+1  A: 

Depending on your using statements you may be referencing the wrong IndexDefinition class (from another Raven assembly). Try adding this to the beginning of your file:

using Raven.Client.Indexes;

You might need to remove other using statements as well. I guess this is one reason why Microsoft recommends using unique names for classes even in the presence of namespaces.

Cwan
Thanks that was it. I don't know how I missed that one. That was about the only using directive that I did not include.
Jim Reineri
This is a direct result of a pervasive problem with code tutorials, examples, and explanations everywhere on the net. Why do people rarely include the 'using' directives?
Jim Reineri
That's a good point, should I start doing that in my examples?
Rob Ashton