如何使用注释或 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/