speckle-sharp icon indicating copy to clipboard operation
speckle-sharp copied to clipboard

refactor(core): DynamicBase model methods are misleadingly named

Open clairekuang opened this issue 3 years ago • 2 comments
trafficstars

GetDynamicMemberNames() is used in the serializer and actually returns names of all properties (both dynamic and typed) GetDynamicMembers() only return dynamic properties GetMemberNames() returns names of all properties (except those with SchemaIgnore attribute) and is not used.

The serlializer should use GetMemberNames() and check if there are any instances of GetDynamicMemberNames() outside of Core that may not be used correctly.

clairekuang avatar Feb 17 '22 21:02 clairekuang

@AlanRynne this can be fixed now maybe?

teocomi avatar Sep 26 '22 14:09 teocomi

It can once we merge in https://github.com/specklesystems/speckle-sharp/pull/1620, since it contains a better implementation of GetMembers() that should work for all the old cases either by:

  • Calling GetMember(ENUM_OF_THE_DESIRED_MEMBERS) to get a dictionary or
  • Calling .Keys on the result to get the member names

This allows us to flag everything else as obsolete except GetDynamicMemberNames which is an override method of DynamicObject.

There's one last minor change around GetInstanceMembers, which has a completely different return type (returns PropInfo classes (reflection) instead of Dictionary<string,object>, and I think we could make it just static and leave it as a utility method.

AlanRynne avatar Sep 27 '22 07:09 AlanRynne

First part our of 3 to close this issue is done in #1832

Updated the issue message to reflect the pending steps that should be done for 2.11 and 2.12

AlanRynne avatar Nov 11 '22 09:11 AlanRynne

Closing this ticket as we are moving to Jira to reduce noise. You can access it there.

bimgeek avatar Dec 14 '23 10:12 bimgeek