Skip to content

[BUG] Database paths/names with "=" sign are not welcome. #2211

@nightroman

Description

@nightroman

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions