我要通过RavenDb.net网站上的RavenDB教程。结果 眼看就要罚款,直到我到了创建索引的代码模块。结果 此代码段是直接从RavenDB.Net网站。结果

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

我上编译得到一个错误:“非通用类型‘Raven.Database.Indexing.IndexDefinition’不能与类型参数被用在”

如果的 IndexDefinition 不通用,它为什么用作示例代码通用?哪里断开?

感谢您的时间 吉姆

有帮助吗?

解决方案

根据你使用的语句可能会引用错误IndexDefinition类(从另一个乌鸦大会)。尝试添加给你的文件的开头:

using Raven.Client.Indexes;

您可能需要删除其他using语句也是如此。我想这就是为什么微软建议即使在命名空间的情况下使用类唯一的名称的原因之一。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top