Artemis-RGB / Artemis

Provides advanced unified lighting across many different brands RGB peripherals
https://artemis-rgb.com
Other
931 stars 67 forks source link

Storage - Replace LiteDB with SQLite + EF Core #843

Closed RobertBeekman closed 3 months ago

RobertBeekman commented 4 months ago
DarthAffe commented 4 months ago

Two things I noted:

  1. The context in EF Core is not designed to be stored and kept alive for the lifetime of the application, but to be created when needed and disposed afterwards (https://learn.microsoft.com/en-us/ef/core/dbcontext-configuration/#the-dbcontext-lifetime)
  2. You should run #pragma OPTIMIZE from time to time (I don't think it's necessary on each db close, but maybe on application start/exit (https://www.sqlite.org/pragma.html#pragma_optimize and https://www.sqlite.org/lang_analyze.html)