Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve collation conflicts with the Entity Framework?

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:

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

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?

like image 269
Christian Rios Avatar asked Nov 03 '22 05:11

Christian Rios


1 Answers

My understanding is that EF does not support this feature.

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

like image 97
qujck Avatar answered Nov 12 '22 14:11

qujck