Skip to content

Instantly share code, notes, and snippets.

@FransBouma
Last active August 29, 2015 14:08
Show Gist options
  • Save FransBouma/8403b388aa30d3207be2 to your computer and use it in GitHub Desktop.
Save FransBouma/8403b388aa30d3207be2 to your computer and use it in GitHub Desktop.
How in-memory .net calls are in-lined in the final query in LLBLGen Pro's linq provider
var q = ctx.Customers.Select(c=>new Customer() { CompName = SomeMethod(c.CompanyName)});
-> visit the select lambda, and convert it so it becomes:
(values, indices) => new Customer() { CompName = SomeMethod(values[indices[0]])};
then compile the lambda. At projection time, execute the lambda with the object[] obtained from the datareader as 'values'
and a set of indices, one for each db value placed in the project. This way you can have any in-memory call in the projection
doing any code, without complicated conversions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment