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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 (afb86ed) to head (c039722).
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      3840    3840           
  Branches    424     424           
====================================
- Hits       3160    3159    -1     
- Misses      516     517    +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.

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