I understand that a LINQ provider is the "thing" that transforms the actual LINQ query into a SQL query (or whatever). It does so by traversing the AST of the LINQ query, and rendering an appropriate SQL query. So far, so good.
Now I can imagine that this works for simple C# code, such as
where person.Age >= 18
which can be (mostly directly) translated to SQL. But what if I provide arbitrary complex C# code, such as:
where person.Name.StartsWith(person.Age < 25 ? 'X' : 'Y')
There is no equivalent to this in SQL, so what does the LINQ provider do in such a case?
Not sure how it will actually write the SQL (you could test it), but it could be simply:
To get the actual SQL (assuming it works): profile the connection.
But indeed; not all things are possible, and often it will simply throw an exception to indicate that it doesn't recognise something or cannot construct the SQL. For example, if you do:
then I would expect it to fail.