的EntityFramework的ConnectionString UTF8 [英] EntityFramework ConnectionString utf8

查看:618
本文介绍了的EntityFramework的ConnectionString UTF8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要UTF8支持添加到我的实体框架的数据库应用程序(SQL Server 2008 R2中)

I want to add utf8 support to my Entity Framework database application (sql server 2008 r2)

我想我需要的字符集添加到ConnectionString中。

I think I need to add the charset to the connectionString.

这是我的connectionString是如何工作的(匿名,当然)

This is how my connectionString works (anonymized, of course)

<add name="MyContainer" connectionString="metadata=res://*/MyDatabase.csdl|res://*/MyDatabase.ssdl|res://*/MyDatabase.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=myserver\instancename;Initial Catalog=MyCatalog;Persist Security Info=True;User ID=USERNAME;Password=PASSWORD;MultipleActiveResultSets=True;&quot;" providerName="System.Data.EntityClient" />

我看了一下connectionstrings.com,但是我发现有关UTF8什么。

I had a look at connectionstrings.com, but I found nothing regarding utf8.

我尝试添加的charset = UTF8 ,但这并不做的伎俩。

I tried adding charset=utf8, but that doesn't do the trick.

 <add name="MyContainer" connectionString="metadata=res://*/MyDatabase.csdl|res://*/MyDatabase.ssdl|res://*/MyDatabase.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=myserver\instancename;Initial Catalog=MyCatalog;Persist Security Info=True;User ID=USERNAME;Password=PASSWORD;MultipleActiveResultSets=True;charset=utf8;&quot;" providerName="System.Data.EntityClient" />

在System.Data.EntityException结果:
{基础提供的ConnectionString的失败。}
{关键字不支持:字符集}

Results in a System.Data.EntityException: {"The underlying provider failed on ConnectionString."} {"Keyword not supported: 'charset'."}

问:结果
 如何设置在ConnectionString的字符集为utf8?或者是默认?启用UTF8

推荐答案

UNI code的使用是通过变量或列类型定义的。 字符 VARCHAR 都是非UNI code和 NCHAR 为nvarchar 是单向code(UCS-2)。

Usage of unicode is defined by variable or column type. Char and varchar are non-unicode and nchar and nvarchar are unicode (UCS-2).

也有它定义code页字符排序规则和 VARCHAR 列和以何种方式比较字符串和有序。每个数据库都有一个默认的整理和每列或变量可以有明确定义的其他排序规则。

There are also collations which define code page for char and varchar columns and the way in which strings are compared and ordered. Each database has a default collation and each column or variable can have explicitly defined other collation.

字符集不连接配置。

这篇关于的EntityFramework的ConnectionString UTF8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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