Quantcast
Channel: entityframework Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1793

New Post: Proposal: User-defined Expression visitors

$
0
0
Using Microsoft.Linq.Translations (to implement computed properties), I can call .WithTranslation() on the IQueryable or Expression.

I've used this method of computing relational properties to return such things as the latest Login for the User (which has a set of Logins) and to add calculated fields (compatible with efficient server-side filtering, sorting and grouping) to the UI while keeping the business logic in one place.

I'd like to implement this change in EF6.

As a proof-of-concept, I added expression = Microsoft.Linq.Translations.ExpressiveExtensions.WithTranslations(expression); to ExpressionConverter() just below the DebugCheck lines, and the result was, as expected, that I didn't need to call .WithTranslation() everywhere else.

EF team: From a design point of view, is there a preferred way of implementing intercepting filter(s) in EF6? An event with a ref Expression parameter? Virtual function on DbContext and ObjectContext? I lean towards virtual function, because the implementer of the derived classes knows best what changes need to be made to the Expression to make the context work properly.

Apart from the references in the original post, this change would also support a DRY alternative to some use cases for Extension Method Support In Lambda expression.

Viewing all articles
Browse latest Browse all 1793

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>