如何解决与实体框架的归类冲突? [英] How to resolve collation conflicts with the Entity Framework?

查看:68
本文介绍了如何解决与实体框架的归类冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的EF模型从数据库中获取数据,该数据库具有从链接服务器获取数据的视图.链接服务器中数据库的排序规则已更改为SQL_Latin1_General_CP1_CI_AS,但未更改为服务器.我假设这是归类冲突的来源.每次我使用该视图进行联接时,都会不断出现此错误:

My EF model gets data out of a Database that has a view that gets data from a linkedserver. The Collation of the Database in the linkedserver has been changed to SQL_Latin1_General_CP1_CI_AS but not the servers. I am assuming that is where the collation conflict comes from. Every time I do a join with that view I keep getting this error:

在等于操作中,无法解决\"SQL_Latin1_General_CP1_CI_AS \"和\"Modern_Spanish_CI_AS \"之间的排序规则冲突.

"Cannot resolve the collation conflict between \"SQL_Latin1_General_CP1_CI_AS\" and\"Modern_Spanish_CI_AS\" in the equal to operation."

我发现使用COLLATE在SQL中可以轻松解决排序规则问题.我似乎找不到使用LINQ做到这一点的方法.可以使用LINQ来解决这个问题,还是应该以其他方式解决这个问题?

I found that collation problems are easily solved in SQL using COLLATE. I can not seem to find a way to do this with LINQ. Can LINQ be used to handle this or should I be tackling this problem in a different way?

推荐答案

我的理解是EF不支持此功能.

My understanding is that EF does not support this feature.

您可以创建一个新视图来解决冲突并使用EF查询新视图.

You can create a new view to resolve the conflict and query the new view with EF.

这篇关于如何解决与实体框架的归类冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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