dotnet / efcore

EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
https://docs.microsoft.com/ef/
MIT License
13.75k stars 3.18k forks source link

Support specifying durability for Memory Optimized tables #34332

Open wdhenrik opened 2 months ago

wdhenrik commented 2 months ago

When adding a memory optimized table, the database is also configured as memory optimized. I need to use a table DURABILITY of SCHEMA_ONLY, but that option is not exposed through EFC (#6405). Durability can only be set when the table is created. This will require a custom migration for the table which would then also require custom migration to change the database configuration.

Is there any configuration I can use to set the database to allow memory optimized tables without also creating a table?

I'd prefer to use the built-in configurations for the database as that would also make the configuration visible in code.

The alternative is that I create the memory optimized table with standard durability so the database is configured, then use a custom migration to drop and recreate the table with the desired durability.

And just in case the SCHEMA_ONLY question is raised, I have an integration point with an external app that needs to have a high performance way of performing CRUD operations. No data is needed between restarts and using SCHEMA_ONLY eliminates disk I/O to further improve performance.
 

AndriySvyryd commented 2 months ago

Configuring the database for memory-optimized tables without creating any is out of scope for EF. However, we can add a way to configure the durability of created tables.

wdhenrik commented 2 months ago

Yes. That would be great!