简体   繁体   English

索引属性解决 Microsoft.EntityFrameworkCore 中的问题

[英]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在这里阅读更多

Indexes 索引

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.

相关问题 Microsoft.EntityFrameworkCore 中 ExecuteScalar 的对应项 - Counterpart of ExecuteScalar in Microsoft.EntityFrameworkCore 命名空间“Microsoft.EntityFrameworkCore”中不存在“迁移” - 'Migrations' does not exist in the namespace 'Microsoft.EntityFrameworkCore' 如何禁用 Microsoft.EntityFrameworkCore 中的约定? - How to disable conventions in Microsoft.EntityFrameworkCore? 网站无法加载 Microsoft.EntityFrameworkCore - Website cannot load Microsoft.EntityFrameworkCore 如何为 Microsoft.EntityFrameworkCore 3.1 方法 FirstOrDefaultAsync 创建 xunit 测试? - How to create xunit test for Microsoft.EntityFrameworkCore 3.1 method FirstOrDefaultAsync? 在.NET Standard项目中找不到Microsoft.EntityFrameworkCore类型 - Type not found Microsoft.EntityFrameworkCore in .NET Standard project 安装Microsoft.EntityFrameworkCore v1.1.4时出错 - Error Installing Microsoft.EntityFrameworkCore v1.1.4 Microsoft.EntityFrameworkCore:没有为此 DbContext 配置数据库提供程序 - Microsoft.EntityFrameworkCore: No database provider has been configured for this DbContext 无法从 Nuget 包管理器安装 Microsoft.EntityFrameworkCore - Not able to install Microsoft.EntityFrameworkCore from Nuget Package Manager Microsoft.EntityFrameworkCore ProjectTo() 找不到我的存储库的方法定义 - Microsoft.EntityFrameworkCore ProjectTo() Method definition not found for my repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM