neisbut / EntityFramework.MemoryJoin

Extension for EntityFramework for joins to in-memory data
MIT License
56 stars 24 forks source link

Support for Sqlite (Feature Request) #14

Closed ScottRapsey closed 3 years ago

ScottRapsey commented 4 years ago

Feature Request – Support for Sqlite Support Sqlite so that code that uses MemoryJoin can have Unit Tests that use Sqlite’s InMemory database rather than only having Integration Tests that use Sql Server.

Sqlite Core nuget package is here: https://www.nuget.org/packages/Microsoft.Data.Sqlite.Core/ Source is here: https://github.com/dotnet/efcore/tree/master/src/Microsoft.Data.Sqlite.Core

I think the main problem is that Sqlite doesn't support named columns for derived tables so SELECT * FROM (VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) AS __gen_query_data__ (id, string1, long1, date1, string2, long2, double1, date2) WHERE 1=0

would need to become something like:

SELECT 1 as string1, 2 as long1, 3 as date1, 4 as string2, 5 as long2, 6 as double1, 7 as date2 FROM (VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) AS __gen_query_data__ WHERE 1=0

Additional Support for the MS InMemory DB would be even better, but probably much harder because it doesn't support CreateCommand() https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.InMemory

sebbe33 commented 4 years ago

I actually added support for SQLite while testing this library last year. Never got so far as to publishing the changes, but I'm going to use the lib with SQLite now, so here's Pull Request #15 for SQLite support.

neisbut commented 4 years ago

Hi @sebbe33 , thanks again with helping with this. Changes are deployed under 0.7.0 version. Pleae check when possible, thanks!

sebbe33 commented 4 years ago

No problem at all. Happy to help :)

Thanks for getting the release out quickly!