相关疑难解决方法(0)

Asp.net核心实体框架找不到IndexAttribute

在执行"dotnet run"后,我在Mac上的Visual Studio Code中收到以下内容,包括IDE和控制台窗口:

找不到类型或命名空间名称"IndexAttribute"

我有一个名为Story的类,我想用它来生成Code First数据库.此类具有标记有KeyAttribute的主键和使用MaxLengthAttribute标记的Author字符串,因此这两者都有效(使用System.ComponentModel.DataAnnotations).另外两个字段,DateTime Date和bool IsPublished,应用了IndexAttribute(它是一个两列索引).我明确地将其命名为IX_DatePublished,IsUnique = false,并将Date = 1用于Date字段,将Order = 2用于IsPublished字段.

  • 在运行"dotnet restore"之前我应该​​在project.json中放入什么来让它为IndexAttribute提供合适的工作?
  • ASPCore1 for Mac/Linux中包含的EF是否包含正确的命名空间?

谢谢!

c# asp.net entity-framework asp.net-core asp.net-core-1.0

12
推荐指数
3
解决办法
6378
查看次数