QueryInterceptor.Core icon indicating copy to clipboard operation
QueryInterceptor.Core copied to clipboard

InterceptWith() ignores Includes()

Open RicoSuter opened this issue 7 years ago • 0 comments

When I add an interceptor before the Includes(), the includes are not made by EF:

var activeAccounts = await ctx.Accounts
    .InterceptWith(new PropertyVisitor())
    .Include(a => a.Subject)
    .Where(a => a.IsActive)
    .ToListAsync();

But this works:

var activeAccounts = await ctx.Accounts
    .Include(a => a.Subject)
    .Where(a => a.IsActive)
    .InterceptWith(new PropertyVisitor())
    .ToListAsync();

The problem is, that I need to specify the interceptor first because I'd like to expose already intercepted IQueryables in my ctx so that the InterceptWith call is not needed by the ctx user...

FYI: I use https://github.com/StefH/Linq.PropertyTranslator.Core here...

RicoSuter avatar Mar 17 '17 08:03 RicoSuter