Closed alexmg closed 1 year ago
As always, InMemory lacks important capabilities of other providers, and is discouraged for use for testing: for unit testing not involving the database, use a repository pattern that allows swapping out LINQ querying entirely; otherwise, test against the same database engine you use in production (see the docs for more info).
It's true that unlike features like SQL and transactions, it's at least possible to bring JSON and primitive collection support to InMemory. However, the time spent on implementing that would most probably be better spent delivering more valuable features.
Note from triage: we will not be bringing this support to the in-memory database.
I was testing the support for primitive collections today and was able to use them successfully with the SQL Server provider but not the in-memory provider. It's common for the in-memory provider to be used in unit tests and the lack of support for this feature puts it into the same category as using provider specific features with
FromSql
.Updating the NewInEfCore8.PrimitiveCollectionsInJsonSample to use the in-memory provider results in the exception below. The same exception is thrown after upgrading the packages to version
8.0.0-preview.5.23280.1
.Do you intend to add the same capability to the in-memory provider to enable parity for unit testing and similar scenarios? The quote below from the JSON columns section of the Plan for Entity Framework Core 8 document indicates the intent is to aim for support across all providers.
Hopefully the in-memory provider will not have to wait until all other providers are at parity. That would make the feature less useful for those using a supported provider in combination with the in-memory provider.
EF Core version: 8.0.0-preview.5.23280.1 Database provider: Microsoft.EntityFrameworkCore.InMemory Target framework: .NET 6.0 Operating system: Windows 10 Enterprise IDE: Visual Studio 2022 17.6.3
Full stack trace: