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

Error when calling DeleteAsync() on a query that uses Sql Server HierarchyId type as a column type #765

Open
lsrigel opened this issue May 30, 2023 · 4 comments
Assignees

Comments

@lsrigel
Copy link

lsrigel commented May 30, 2023

Thanks for the great library, we have just done an upgrade to .Net6 and are seeing the following error.

1. Description

When calling DeleteAsync() on a query that uses Sql Server HierarchyId type as a column type, we get an error (see below)

e.g. (divisionId is type Microsoft.EntityFrameworkCore.HierarchyId)

  await _dbContext.TableName
                       .Where(table => table.DivisionId == divisionId)
                       .DeleteAsync();

2. Exception Stacktrace (trimmed to only include library component)

MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen, Boolean streamAllowed)
MetaType.GetMetaTypeFromType(Type dataType)
SqlParameter.GetMetaTypeOnly()
SqlParameter.Validate(Int32 index, Boolean isCommandProc)
SqlCommand.BuildParamList(TdsParser parser, SqlParameterCollection parameters, Boolean includeReturnValue)
SqlCommand.BuildExecuteSql(CommandBehavior behavior, String commandText, SqlParameterCollection parameters, _SqlRPC& rpc)
SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method) SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) SqlCommand.ExecuteScalar() <>c.(DbCommand ) BatchDelete.Execute[T](IQueryable1 query)
BatchDeleteExtensions.Delete[T](IQueryable1 query, Action1 batchDeleteBuilder)
<>c__DisplayClass2_01.<DeleteAsync>b__0() Task1.InnerInvoke()
<.cctor>b__272_0(Object obj)
ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)

Exception message:
"No mapping exists from object type Microsoft.EntityFrameworkCore.HierarchyId to a known managed provider native type." 

4. Any further technical details

This was working fine until a recent upgrade to .Net 6 (from 3.1)
Using EF core 6.0.16
image

@JonathanMagnan JonathanMagnan self-assigned this May 30, 2023
@JonathanMagnan
Copy link
Member

Hello @lsrigel ,

Thank you for contacting us.

My developer will look at it if we can easily support this or not.

Best Regards,

Jon

@JonathanMagnan
Copy link
Member

Hello @lsrigel ,

Just to give you an update: My developer has fixed this issue. The fix will be part of the next release, that will happen in 1 or 2 weeks.

Best Regards,

Jon

@lsrigel
Copy link
Author

lsrigel commented Jun 2, 2023

Thank you, appreciate the effort

@JonathanMagnan
Copy link
Member

Hello @lsrigel ,

Sorry for the delay, the fix has been finally been released today. If you are using EF Core 6, the fix should be available in the version v6.22.4

Best Regards,

Jon

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

2 participants