实体框架代码第一 - 更改表列排序规则 [英] Entity Framework Code First - Change Table Column Collation

查看:122
本文介绍了实体框架代码第一 - 更改表列排序规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Entity Framework CTP5和Code First。我需要更改SQL Server中特定列的排序规则。我相信默认排序规则是SQL_Latin1_General_CP1_CI_AS,但是我需要将这一列更改为SQL_Latin1_General_CP1_CS_AS(区分大小写)。



有没有办法在Code First中使用ModelBuilder更改特定列排序规则?



BarDev

解决方案

不允许这个,但是您可以创建自定义数据库初始化程序并执行 ALTER TABLE 命令。该示例将与创建自定义索引的这一个相同。


I'm using Entity Framework CTP5 and Code First. I need to change the Collation for a specific column in SQL Server. I believe the default collation is SQL_Latin1_General_CP1_CI_AS, but I need to change this one column colllation to SQL_Latin1_General_CP1_CS_AS (Case Sensitive).

Is there a way to use ModelBuilder in Code First to change a specific column collation?

BarDev

解决方案

Model builder doesn't allow this but you can create custom database initializer and execute ALTER TABLE command. The example will be the same as this one creating custom index.

这篇关于实体框架代码第一 - 更改表列排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆