-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Hassmodel APIs creates entities of types created by nd-codegen #1188
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1188 +/- ##
====================================
Coverage 82% 82%
====================================
Files 193 196 +3
Lines 3790 3820 +30
Branches 425 428 +3
====================================
+ Hits 3132 3162 +30
Misses 491 491
Partials 167 167
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean and nice code as usual. Specially liked the tests you added!
var entityClasses = EntitiesGenerator.Generate(entityDomains); | ||
var serviceClasses = ServicesGenerator.Generate(orderedServiceDomains); | ||
var extensionMethodClasses = ExtensionMethodsGenerator.Generate(orderedServiceDomains, entityDomains); | ||
|
||
return new[] { helpers, entityClasses, serviceClasses, extensionMethodClasses }.SelectMany(x => x).ToArray(); | ||
return [..helpers, entityFactory, ..entityClasses, ..serviceClasses, ..extensionMethodClasses]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just love this syntax!
* Added GeneratedEntityFactory * fix test
Proposed change
When using nd-codegen the HassModel API's can now return entities of the generated types. So you can eg do
var allLights = haContext.GetAllEntities().OfType()
Type of change
Additional information
Checklist
If user exposed functionality or configuration are added/changed: