实体框架代码优先 - 更改表列整理

时间:2022-06-08 00:46:37

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).

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

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

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

BarDev

BarDev

2 个解决方案

#1


10  

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.

模型构建器不允许这样做,但您可以创建自定义数据库初始化程序并执行ALTER TABLE命令。该示例与创建自定义索引的示例相同。

#2


0  

Use the RenameTable(String name, string newName)

使用RenameTable(String name,string newName)

#1


10  

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.

模型构建器不允许这样做,但您可以创建自定义数据库初始化程序并执行ALTER TABLE命令。该示例与创建自定义索引的示例相同。

#2


0  

Use the RenameTable(String name, string newName)

使用RenameTable(String name,string newName)