I want to be able to pick a url-formatted string (like united-kingdom ) I am ) And use it in a WHERE section against that country's column, which is not formatted like this (e.g. United Kingdom ). Ideally, I do something like this: I understand that this is none because AF will attempt to launch and execute SQL applications. It gives me: "The method for LINQ does not recognize the method 'system string string mystream formatting extension (system.string)', and this method can not be translated into store expression." It has been suggested that I return the query as a number before implementing this question, although I think that it is very inefficient - before all the rows from DB before filtering Is returning. You can define a user defined function and import that is in your database more Read the description for Alternatively, you can create a view in your database that satisfies the string you want to format, so include it in your linux query . See
db.Jobs. Where (j = & gt; j.ountry.MyStringFormattingExtension () == urlformattedstring);
// Create the SQL function dbo.ToFormattedString ... // C # Public Fixed Class EntityFunctions {[EdmFunction ("dbo", "ToFormattedString")) Public Stabilized String ToFormattedString (this string input) {New NotSupportedException ("direct call is not supported"); }} Var result = db.Jobs.Where (j = & gt; j.ountry.ToFormattedString () == urlFormattedString);
// Create SQL in dbo.vFormattedJobs AS ... // in C # Viral result = (jb in db.vFormattedJobs where j.FormattedCountry == urlFormattedString selection j);
No comments:
Post a Comment