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

Strongly-type EntityState.Attributes #1251

Merged
merged 2 commits into from
Feb 8, 2025

Conversation

333fred
Copy link
Contributor

@333fred 333fred commented Feb 6, 2025

For those working with base entities (such as the IHaRegistry API), the virtual property/covariant return override approach isn't helpful. The base property will always return a Dictionary<string, object>, which can be useful to iterate through. Instead, we should have strongly-typed derived class hide the base property, so users who are just working with pure entities get a useful key/value pair, and derived users get strongly-typed info.

For those working with base entities (such as the IHaRegistry API), the virtual property/covariant return override approach isn't helpful. The base property will always return a `Dictionary<string, object>`, which can be useful to iterate through. Instead, we should have strongly-typed derived class _hide_ the base property, so users who are just working with pure entities get a useful key/value pair, and derived users get strongly-typed info.
@333fred
Copy link
Contributor Author

333fred commented Feb 6, 2025

Important note: this is a breaking change, so we should probably wait for a major version rev to merge?

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 82%. Comparing base (214ee3d) to head (e52cbed).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...c/HassModel/NetDeamon.HassModel/Entities/Entity.cs 0% 1 Missing and 1 partial ⚠️
...sModel/NetDeamon.HassModel/Entities/EntityState.cs 50% 1 Missing ⚠️
Additional details and impacted files
@@         Coverage Diff          @@
##           main   #1251   +/-   ##
====================================
- Coverage    82%     82%   -1%     
====================================
  Files       196     196           
  Lines      3854    3854           
  Branches    424     424           
====================================
- Hits       3175    3174    -1     
- Misses      515     516    +1     
  Partials    164     164           
Flag Coverage Δ
unittests 82% <25%> (-1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@helto4real helto4real merged commit d37b84b into net-daemon:main Feb 8, 2025
6 of 7 checks passed
@helto4real
Copy link
Collaborator

About the breaking change. It will probably not affect most people. If they subclassed it or smth it is a breaking change. There will be no supported ways to have two different versions of the apps that are compiled and the runtime anyhow. It is OK.

@333fred 333fred deleted the break-attributes branch February 8, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants