NMFCode / NMF

This repository contains the entire code for the .NET Modeling Framework
BSD 3-Clause "New" or "Revised" License
36 stars 15 forks source link

API question: how to find all usages of an object? #63

Closed RobertWalterU3d closed 8 months ago

RobertWalterU3d commented 2 years ago

Hi,

is there an API that allows me to get all usages of a object (all references) in the scope of the currently loaded model?

Thanks!

georghinkel commented 2 years ago

Hi,

so the immediate answer is "no, there isn't", but interestingly, I think such an API could be possible without that much computational effort, though either quite dirty or coming with breaking changes to the generated code.

The thing is that when a model element references another, it currently subscribes to its Deleted event. That is an implicit reference that could be either brought to a good level (clean solution) or simply abused by iterating the target objects of the invocation list of that event and gathering all model elements from there.

The problem here is that I am in the middle of a rather complex refactoring without really having time for NMF at all. I cannot commit to any timeline at the moment.

Best regards,

Georg

RobertWalterU3d commented 2 years ago

No worries Georg, and thanks for the explanation. Turns out I actually don't need it for my prototype, since my use case (rename-refactoring) works out of the box.