开发者

EntityFramework ConnectionString utf8

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

I think I need to add the charset to the conn开发者_开发百科ectionString.

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" />

I had a look at connectionstrings.com, but I found nothing regarding 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" />

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

Question:

How do I set the charset to utf8 in the connectionString? Or is utf8 enabled by default?


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

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.

Character set is not configured by connection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜