在执行"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字段.
谢谢!