demetrixbio / FSharp.Data.Npgsql

F# type providers to support statically typed access to input parameters and result set of sql statement in idiomatic F# way. Data modifications via statically typed tables.
Apache License 2.0
127 stars 16 forks source link

Changing global parameters should reload all cache #87

Open Swoorup opened 4 years ago

Swoorup commented 4 years ago

It appears the type provider cache's generated members for each sql statement which is great but fails to regenerate members and uses a stale cache, when any of the global parameters is updated, namely the XCtor.

To Reproduce:

kerams commented 4 years ago

The simplest solution would be to make the global parameters part of the cache key:

https://github.com/demetrixbio/FSharp.Data.Npgsql/blob/d4825fae12f34e7fab624f95cb932fc83097285e/src/DesignTime/NpgsqlConnectionProvider.fs#L30-L40

A lot of parameter changes without having a mechanism to flush the cache will lead to memory bloat, but I don't think it's something we need to really worry about.