I'm trying to unit test a fairly straightforward repository method that retrieves some entities which match any of a supplied list of string mapping ids.
The implementation uses EF Extension WhereBulkContains
and I'm specify the entity column that the WhereBulkContain
should match against using a lambda.
public List<MyEntity> GetEntitiesByMappingId(List<string> mappingIds)
{
if (!mappingIds?.Any() ?? true)
{
return new List<MyEntity>(0);
}
return this
.context.MyEntity
.AsNoTracking()
.Include(e => e.ExtraData)
.Include(e => e.OtherData)
.WhereBulkContains(mappingIds, e => e.MappingId)
.ToList();
}
When my test triggers this method it fails with the following underlying exception.
System.Exception
Oops! The `SkipInsertForInternalFeatures` option is only available for SQL Server, and PostgreSQL.
at Z.BulkOperations.BulkOperation.()
at Z.BulkOperations.BulkOperation.Execute()
at Z.EntityFramework.Extensions.EntityBulkOperation`1.BulkInsert()
at .BulkInsert[T](BulkOperation`1 this, DbContext context, List`1 list, Boolean isManager, List`1 entitiesToUpdate, Type type, String typeName)
at .BulkInsert[T](DbContext this, BulkOperation`1 bulkOperation, IEnumerable`1 entities2, List`1 entitiesToUpdate)
at DbContextExtensions.BulkInsert[T](DbContext this, IEnumerable`1 entities, Action`1 bulkOperationFactory)
at Z.EntityFramework.Plus.WhereBulkContainsBuilder`1.BulkCopy(DbContext context, List`1 keyNames, IEnumerable`1 entities, Type type2)
at Z.EntityFramework.Plus.WhereBulkContainsBuilder`1.WhereBulkContains(DbContext context, String commandText, List`1 commandTableBuilders, Boolean isNotCTE, Boolean isNotSelectOnly)
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.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
Is this a known limitation of Effort? Or have I missed some configuration that should allow this to work?
I'm using Effort.EF6 version 2.2.17, and version 8.103.0 of both Z.EntityFramework.Extensions and Z.EntityFramework.Plus.EF6
The list of supported providers for Z.EntityFramework.Extensions
from the NuGet package:
Support: SQL Server, MySQL, Oracle, PostgreSQL, SQLite, and more!
and from the github repo:
Support Multiple SQL Providers:
- SQL Server 2008+
- SQL Azure
- SQL Compact
- MySQL
- SQLite
- PostgreSQL
- Oracle
Effort.EF6 is not listed in either as supported provider.
This explains the message from the exception you get:
System.Exception
Oops! The `SkipInsertForInternalFeatures` option is only available for SQL Server, and PostgreSQL.
at Z.BulkOperations.BulkOperation.()