bugfix - interface is needed for DI#236
Closed
J0EK3R wants to merge 2 commits into
Closed
Conversation
Owner
|
Root cause: untested changes from #231. |
There was a problem hiding this comment.
Pull request overview
This PR addresses DI resolution failures for Mould King devices by introducing an interface for MouldKingDeviceManager and switching Mould King device constructors to depend on that interface, allowing Autofac to resolve the dependency given RegisterDeviceManager<T>() registers managers only as IBluetoothLEDeviceManager.
Changes:
- Added
IMouldKingDeviceManagerand implemented it inMouldKingDeviceManager. - Registered
MouldKingDeviceManagerasIMouldKingDeviceManagerin the vendor DI setup. - Updated Mould King device/base constructors to depend on
IMouldKingDeviceManagerinstead of the concrete manager type.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKingDeviceManager.cs | Implements IMouldKingDeviceManager so DI can inject it via an interface. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MouldKing.cs | Registers the manager as IMouldKingDeviceManager for constructor injection. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseNibble.cs | Switches dependency from concrete manager to interface. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MKBaseByte.cs | Switches dependency from concrete manager to interface. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MK6.cs | Updates constructor to accept IMouldKingDeviceManager. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MK5.cs | Updates constructor to accept IMouldKingDeviceManager. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MK4.cs | Updates constructor to accept IMouldKingDeviceManager. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/MK3_8.cs | Updates constructor to accept IMouldKingDeviceManager. |
| BrickController2/BrickController2/DeviceManagement/MouldKing/IMouldKingDeviceManager.cs | New interface used for DI-friendly dependency injection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
|
|
||
| protected MKBaseByte(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, MouldKingDeviceManager mkDeviceManager,int channelStartOffset, byte[] telegram_Connect, byte[] telegram_Base) | ||
| protected MKBaseByte(string name, string address, byte[] deviceData, IDeviceRepository deviceRepository, IBluetoothLEService bleService, IMKPlatformService mkPlatformService, IMouldKingDeviceManager mkDeviceManager,int channelStartOffset, byte[] telegram_Connect, byte[] telegram_Base) |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Owner
|
Due ti the failing unit tests, I§v8e used Copilot to fix it as separate PR #237. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
here is the fix for #235
An interface (for MouldKingDeviceManager) is needed for DI to resolve this instance.