Skip to content

Avoid the possibility of exceptions in the constructor #11

@mortenbrudvik

Description

@mortenbrudvik

I think it would be better to create and open the connection at the first access to a repository. This is to avoid that you get an exception when you use Dependency Injection at the object creation, but also exceptions in constructor should generally be avoided.

I have done a similar implementation to your UnitOfWork. See link below
https://github.com/mortenbrudvik/SQLiteDapperConsole/blob/main/Infrastructure/UnitOfWork.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions