[英]Index Attribute resolving issue in Microsoft.EntityFrameworkCore
I have got.Net Standart 2.0 dll to keep separated entities of MS SQL Server.我有 .Net Standart 2.0 dll 来保持 MS SQL 服务器的分离实体。
The Index Attribute
cannot be resolving. Index Attribute
无法解析。
I've did search and experimented with adding some namespaces of Entity Framework but nothing works even by MSDN .我已经搜索并尝试添加一些 Entity Framework 的命名空间,但即使是MSDN也没有任何效果。
Please, help.请帮忙。 Thank you!
谢谢你!
IndexAttribute Class 索引属性 Class
Specifies an index to be generated in the database.
指定要在数据库中生成的索引。
Entity Framework Core
实体框架核心
- 5.0
5.0
You are not using EF core 5. You will need to use the model Builder instead您没有使用 EF 核心 5。您需要改用 model Builder
Read more here在这里阅读更多
Configuring indexes via Data Annotations has been introduced in EF Core 5.0.
EF Core 5.0 中引入了通过数据注释配置索引。
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Blog>()
.HasIndex(b => b.Url);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.