You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works fine with EF Core commands. I tested DeleteByKey. With accountId being of type AccountId I expected to call the method with
_dbContext.Person.DeleteByKey(accountId);
Exception
At runtime an exception is thrown: System.ArgumentException: 'No mapping exists from object type Elwis.SharedKernel.Domain.AccountId to a known managed provider native type.'
Workaround
When I use the Guid value that is encapsulated by AccountId the command works:
_dbContext.Person.DeleteByKey(accountId.Value);
The signature of Person.DeleteByKey shows the type AccountId. I don't understand why the conversion doesn't work.
Further technical details
EF Core: 6.0.4
EF Extensions version:6.13.18
Database Provider: SQL Server
The text was updated successfully, but these errors were encountered:
Description
We implement keys with dedicated value objects, e.g. AccountId. In the configuration for the entity a converter is provided with HasConversion().
entity.Property(e => e.Id).HasColumnName("AccountId").HasConversion(DBConverter_SharedKernel.AccountIdConverter);
It works fine with EF Core commands. I tested DeleteByKey. With accountId being of type AccountId I expected to call the method with
_dbContext.Person.DeleteByKey(accountId);
Exception
At runtime an exception is thrown:
System.ArgumentException: 'No mapping exists from object type Elwis.SharedKernel.Domain.AccountId to a known managed provider native type.'
Workaround
When I use the Guid value that is encapsulated by AccountId the command works:
_dbContext.Person.DeleteByKey(accountId.Value);
The signature of
Person.DeleteByKey
shows the type AccountId. I don't understand why the conversion doesn't work.Further technical details
The text was updated successfully, but these errors were encountered: