asp.net-mvc - EF Core 中的 SQL Server 排序规则

标签 asp.net-mvc ef-code-first entity-framework-core ef-core-2.0 entity-framework-core-migrations

如何使用注释或 Fluent API 指定列、表或数据库的排序规则?我知道 MySql Provider 有一些干净的方法。但是,除了执行原始 SQL 命令之外,我找不到 SQL Server 的任何方法。

最佳答案

看起来它根本不会做:

这是aspnet/EntityFrameworkCore 中已关闭的问题:CodeFirst: Set column collation

We discussed and concluded that setting different collations per column isn't a very common requirement and it's probably not something we would make first class in EF. This would be a good candidate for using annotations to define additional metadata and then extending our SQL generators to process those and specify collation.



唯一的解决方案似乎是这个:Entity Framework Code First - Change Table Column Collation

... you can create custom database initializer and execute ALTER TABLE command.

关于asp.net-mvc - EF Core 中的 SQL Server 排序规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48393309/

相关文章:

包含多种类型的类型列表的 c# MVC Entity Framework 模型属性

jquery - getJSON 回调未触发

entity-framework-4 - 如何定义 DatabaseGenerated.Computed 应该计算什么?

c# - 从 C# 运行 Latex

c# - Entity Framework Code First——一张表/多种类型

linq - 多对多 EF LINQ

c# - 无法创建迁移,因为测试项目无法构建,即使主项目可以?

c# - 设置查询结果对象的小数精度

c# - Entity Framework 核心模型

c# - 动态表达返回类型Lambda表达式