Using our previous ORM, OpenAccess, we were able to include helper methods in the select statements of our queries. For example, to combine SQL data with cached application data.
After switching to Entity Framework 6.x we're getting errors like this:
LINQ-to-Entities does not recognize the method 'System.String GetProductTranslation'
The ling query looks like this:
var products = (from p in db.Products
join cp in db.CustomerPrices on p.ProductId equals cp.ProductId
where p.LockedSince.Equals(null)
&& ... etc etc etc
select new
{
ProductId = p.ProductId,
Name = TranslationHelper.GetProductTranslation(p.ProductId, ProductTranslationField.Name, p.Name),
Description2 = TranslationHelper.GetProductTranslation(p.ProductId, ProductTranslationField.Description2, p.Description2),
Description3 = TranslationHelper.GetProductTranslation(p.ProductId, ProductTranslationField.Description3, p.Description3),
Description4 = TranslationHelper.GetProductTranslation(p.ProductId, ProductTranslationField.Description4, p.Description4),
... etc etc etc
});
In this case the GetProductTranslation method grabs translation data from the application cache to prevent using endless amounts of joins and stress on the database.
What would be the best way to replicate this using Entity Framework 6.x?