Skip to content
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

Cleanup ServiceLocator pattern in favor of proper DI #46

Closed
7 tasks done
tthiery opened this issue Jul 8, 2020 · 1 comment
Closed
7 tasks done

Cleanup ServiceLocator pattern in favor of proper DI #46

tthiery opened this issue Jul 8, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@tthiery
Copy link
Member

tthiery commented Jul 8, 2020

  • Active Connection == own Scope
    • Create Scope in host during hub/protocol initialization
  • Move the following types to a AddScoped lifetime
    • BluetoothKernel (remove bluetoothAddress from constructor and move to ConnectAsync)
    • PoweredUpProtocol (add deviceFactory as a constructor argument and remove IServiceProvider service locator trap)
    • Rewrite DeviceFactory/HubFactory to use Transient types in the IServiceProvider. OPEN QUESTION: How to handle hubId and portId in an elegant way
    • Add constructor argument deviceFactory to hub.
  • Add interface to PoweredUpHost to wire up a protocol

non-breaking in theory

@tthiery tthiery added the enhancement New feature or request label Jul 8, 2020
@tthiery tthiery added this to the v2.2 milestone Aug 1, 2020
@tthiery tthiery self-assigned this Aug 1, 2020
tthiery added a commit that referenced this issue Aug 1, 2020
tthiery added a commit that referenced this issue Aug 1, 2020
- Add constructor for IDeviceFactory
- Moved PoweredUpProtocol creation into the DI + Host
- Moved BluetoothKernel creation into the DI

#46 non-breaking (all types internal)
@tthiery
Copy link
Member Author

tthiery commented Aug 1, 2020

Wrongly aligned commit 3a4f709

tthiery added a commit that referenced this issue Aug 1, 2020
#46 non-breaking
tthiery added a commit that referenced this issue Aug 3, 2020
- Change CLI code base to user DI instead of SL pattern
- Remove Infrastructure code from CLI commands
- Add PoweredUpHost.CreateProtocol and expose
  related scoped service provider on IPoweredUpProtocol

#46 non-breaking (since non-host direct communication is not contract)
tthiery added a commit that referenced this issue Aug 3, 2020
tthiery added a commit that referenced this issue Aug 4, 2020
tthiery added a commit that referenced this issue Aug 6, 2020
tthiery added a commit that referenced this issue Aug 6, 2020
- Expose CreateProtocolScope method in host

#46 non-breaking
tthiery added a commit that referenced this issue Aug 6, 2020
- Remove many Service Locator usages
- Move HubFactory to be based on DI
- Move Protocol creation into DI and out of hub etc.
- Adjust CLI
- Fix await warnings

#46 non-breaking (all types internal)
@tthiery tthiery closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant