What .NET StringComparer is equivalent SQL's Latin1_General_CI_AS

前端 未结 4 767
借酒劲吻你
借酒劲吻你 2021-02-07 18:50

I am implementing a caching layer between my database and my C# code. The idea is to cache the results of certain DB queries based on the parameters to the query. The database i

4条回答
  •  醉梦人生
    2021-02-07 19:51

    Take a look at the CollationInfo class. It is located in an assembly called Microsoft.SqlServer.Management.SqlParser.dll although I am not totally sure where to get this. There is a static list of Collations (names) and a static method GetCollationInfo (by name).

    Each CollationInfo has a Comparer. It is not exactly the same as a StringComparer but has similar functionality.

    EDIT: Microsoft.SqlServer.Management.SqlParser.dll is a part of the Shared Management Objects (SMO) package. This feature can be downloaded for SQL Server 2008 R2 here:

    http://www.microsoft.com/download/en/details.aspx?id=16978#SMO

    EDIT: CollationInfo does have a property named EqualityComparer which is an IEqualityComparer.

提交回复
热议问题