Skip to content

Use dependency injection in more places #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
deansheather opened this issue Apr 29, 2025 · 0 comments
Open

Use dependency injection in more places #80

deansheather opened this issue Apr 29, 2025 · 0 comments

Comments

@deansheather
Copy link
Member

In some places where we need to pass parameters that aren't DI-able, we are using a pattern of DI-ing the fields to the "parent" and then passing them to the new child without using DI.

Ideally we use DI as much as possible and not pass stuff down. We may need to use factories to accomplish this.

E.g.

class MyClass(ISomethingProvider somethingProvider)
{
  public ChildClass CreateChild(string myParam)
  {
    return new ChildClass(somethingProvider, myParam);
  }
}

RootFrame.Content = new FileSyncListMainPage(ViewModel, this);

Also the yet to be merged remote directory picker contains an instance of this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant