문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top