This package allows passing memory data to the EFcore provider which are able to be LINQed by the server without client evaluation.
$ dotnet add package Noticia.EntityFrameworkCore.MemoryJoinThis package allows passing memory data to the EFcore provider which are able to be LINQed by the server without client evaluation.
dotnet add package Noticia.EntityFrameworkCore.MemoryJoin
You need to register models that you want to pass to the server in your database context:
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.MemoryEntity<TestModel>();
}
Note that TestModel must not have a property named Id. This package auto-generates the underlying entity type via reflection and requires this property internally.
The memory entities a real table. They only need to be registered in the . For migrations you can safely use methods to disable this command (i.e. preprocessor directives checking whether migrations are running).
DbContextFor generating the server-known entities you call:
dbContext.AsMemoryEntities(models);The given reference can be passed to the LINQ join method:
.Join(memoryEntities, ...)This package was developed for using with OData and AutoMapper. Since all evaluation occurs on the server-side AutoMappers .ProjectTo is fully supported, even when passing your client side data.
Huge thanks to EntityFramework.MemoryJoin. This package has largely been based on their work.