omoto
omoto

Reputation: 1220

How to add collation to Linq expressions?

How to implement method for IQuariable like below:

var trash = (from a in ContextBase.db.Users
                orderby a.FirstName
                select a).ToCollatedList();

In a result I want to see

SELECT * from [User] 
ORDER BY FirstName
COLLATE SQL_SwedishStd_Pref_Cp1_CI_AS ASC

Thanks.

Upvotes: 3

Views: 4809

Answers (2)

Ray Booysen
Ray Booysen

Reputation: 30031

I would expose a view for the different collations and allow the developers to run LINQ to SQL queries against the views.

Upvotes: 2

Jay Bazuzi
Jay Bazuzi

Reputation: 46506

You can't extend the Linq-to-Sql implementation to perform new functionality on the server.

The best you can do is a client-side implementation of collation.

Upvotes: 2

Related Questions