Database paths/names with "=" sign are not welcome.
This is probably a feature but it bites. It's probably the design flaw.
LiteDatabase and ConnectionString constructors accept both database paths
and connection strings. This is "convenient" and usually works fine in test
environments with some usual database paths used as arguments.
Then an app goes to production where any valid paths are possible, including
paths with "=", a valid directory and file name character. These path are
problematic.
Please find attached 3 XUnit tests.
UsingFilePathDirectlyFails shows how LiteDatabase fails with a valid file path.
UsingFilePathConnectionStringFails shows how LiteDatabase fails with ConnectionString with a valid file path.
Workaround shows probably the only reliable way with ConnectionString default constructor.
This issue makes using file paths in LiteDatabase and ConnectionString not
needed in properly designed applications.
Possible solution? For example, instead ambiguous constructors add safe static
Create methods:
LiteDatabase.CreateFromPath(string path)
ConnectionString.CreateFromPath(string path)
_220630_kq-equal-sign-issue.zip
Database paths/names with "=" sign are not welcome.
This is probably a feature but it bites. It's probably the design flaw.
LiteDatabaseandConnectionStringconstructors accept both database pathsand connection strings. This is "convenient" and usually works fine in test
environments with some usual database paths used as arguments.
Then an app goes to production where any valid paths are possible, including
paths with "=", a valid directory and file name character. These path are
problematic.
Please find attached 3 XUnit tests.
UsingFilePathDirectlyFailsshows howLiteDatabasefails with a valid file path.UsingFilePathConnectionStringFailsshows howLiteDatabasefails withConnectionStringwith a valid file path.Workaroundshows probably the only reliable way withConnectionStringdefault constructor.This issue makes using file paths in
LiteDatabaseandConnectionStringnotneeded in properly designed applications.
Possible solution? For example, instead ambiguous constructors add safe static
Createmethods:LiteDatabase.CreateFromPath(string path)ConnectionString.CreateFromPath(string path)_220630_kq-equal-sign-issue.zip