Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WhereBulkContains cannot be joined with another query #729

Open
jzabroski opened this issue May 27, 2022 · 0 comments
Open

WhereBulkContains cannot be joined with another query #729

jzabroski opened this issue May 27, 2022 · 0 comments

Comments

@jzabroski
Copy link

jzabroski commented May 27, 2022

1. Description

I would expect the following to work:

var conversions = Context.Set<ConversionRecord>()
                .WhereBulkContains(conversionIds);
return (from conversionTradeMap in Context.Set()
        join c in conversions
               on conversionTradeMap.Conversion.Id equals c.Id
        select conversionTradeMap)
        .ToList();

2. Exception

If you are seeing an exception, include the full exception details (message and stack trace).

System.Exception
Oops! The following table name `[ConversionRecord] AS [` has not been found in the command text for the `WhereBulkContains` features.
   at Z.EntityFramework.Plus.WhereBulkContainsBuilder`1.CommandTextBuilderSQL(String schema, String tableName, String nameTempTable, List`1 KeyNamesBD, String commandText, Boolean isLast, Boolean isNotCTE)
   at Z.EntityFramework.Plus.WhereBulkContainsBuilder`1.WhereBulkContains(DbContext context, String commandText, List`1 commandTableBuilders, Boolean isNotCTE)
   at Z.EntityFramework.Plus.QueryHookCommandInterceptor.ApplyHook(DbCommand command, DbContext context, String hook, Boolean isNotCTE)
   at Z.EntityFramework.Plus.QueryHookCommandInterceptor.ReaderExecuting(DbCommand command, DbCommandInterceptionContext`1 interceptionContext)
   at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
   at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
   at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)

3. Fiddle or Project

I don't think this should be necessary. However, at minimum, it would be helpful if Limitations document section was updated:

https://entityframework-extensions.net/where-bulk-contains#what-are-the-limitations

The Remarks on the method say that only 1 WhereBulkContains is supported per method, so that should be mentioned in limitations as well.

4. Any further technical details

It would be great for querying one-to-many tables to write:

Context.Set<ParentEntity>().WhereBulkContains(referenceIds, x => x.ChildEntity);

or

Context.Set<ParentEntity>().WhereBulkContains(referenceIds, "ChildEntityId");

However, this doesn't appear to be supported due to zzzprojects/EntityFramework-Extensions#489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant