We're using EF Core with SQL Server as our DB Context in addition to some external data sources that we are currently caching in memory in IDictionary objects among others. We're also using OData to make that data available through our web service.
Ideally, both in our EF Core queries and in our OData mapping, query, expand / etc., everything is seen as a single datasource / EF Core provider / DB Context. No manual merging of data is required that way, which would make some annoying code redundant and eases development.
What we could do is to move all data to SQL Server. This can be done by saving the cached data in regular tables (or durable Memory-Optimized ones), but there can be some sensitive data in there. It's definitely still an option, but we'd rather not deal with that data being 'at rest' in our database, backups, etc.
So we're thinking: could we use the non-durable version of Memory-Optimized SQL Server tables for this? Could it work (reliably)?
We've got a (theoretic) solution, but it assumes the following:
What we're thinking is to have a background worker process execute the following every x seconds:
SELECT COUNT(value) FROM DUMMY
Concrete questions about this proposed solution:
Any better solution in general? we'd rather not deal with that data being 'at rest' in our database, backups, etc.
Honestly, I would just put the tables in a different database. You can use views or synonyms so they look like they are in the main database.
Your assumptions about non-durable tables are correct, and this should work.