-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adapter Ids: where to store them? #167
Comments
Would vote for option 2, even if it will be a fragment with just an int for quite a few cases, like:
and have specific ID fragments for each toolkit. This can then also handle things like Revit, which have more than one ID. ETABS has also more than one way to identify objects which all could be stored in this single fragment. For Revit this is implemented already as a series of This still means easy lookup both in code and UI. Can scan an object for any For me I would go for something like this, or keep on using As for Option 3, I would not want us to go there for various reasons:
|
I think @IsakNaslundBh you capture pretty well what I would think on this. And I do like the idea of a common Finally - I am still up for renaming |
I'd vote option 2 as well, but perhaps do need to do some performance tests before fully implementing? I do think we need a specific dictionary of id's as there will be cases where we need to store multiple as @IsakNaslundBh mentions. Option 3 could work if it was a dictionary of id's of course, but that's a lot of objects to attach id's to at every stage. |
@rwemay for this I would rather have more properties on the ID fragment when needed. For example Revit could end up with something like:
And potentially even add in the family name/type name etc identifiers there (or put them in a separate Would try to stay away from a dictionary if we can, as one nice thing about putting it in a separate object per toolkit is that we can make everything type-strong and well defined. For toolkits that mixes ints and strings for ids (like Robot and Etabs) we can always just use the largest common denominator (object/ICompareable/something else), or just use strings. |
The beauty of the In fact you could actually have On Option 3 - I agree with Isak. I really don’t think it works philosophically for the BHoM.
Think we do need to find a way of optionally storing on objects like the above |
@IsakNaslundBh , @al-fisher , sounds very good, and great to have formal properties. |
Yes, I like that. Could also make the interface into a generic if we wanted, and if we are sure you will more or less always have a main Id. Like:
And then have
etc. Not 100% sure on this, if it helps or makes it more complicated, but could generalise comparison of at least main Ids. If the Generics does not feel like a way forward, I like your suggestion as well @al-fisher |
I agree with Isak too. Option 2 seems to be the most reasonable choice. |
Good to get agreement on point 2. I will plough on and implement that. |
Perfect - thanks @alelom |
Putting as a comment here while thinking of it after discussion with @kThorsager . We have some objects, This is, one BHoM We need to have a strategy for how to deal with this when we switch to the id fragments. |
We have 3 options so far.
1) CustomData
As we do now.
Dictionary<string, object>
.Pro:
Cons:
2) A Fragment.
Pros:
Cons:
In a certain way, the AdapterId is not that appropriate as a fragment.
We would need to explain the concept of Fragments to every single person coming to implement a new toolkit, even if the only thing they need to do is add an
int
to an object. This makes Fragment sound inconvenient.If we want to avoid that, we might have an
AdaptersIdFragment
that actually stores a Dictionary of values, like the CustomData:This comes with a drawback. If you want to add a new Id to the object, you need to:
- check whether it already has an
AdaptersIdFragment
- if it has, store the value contained in its dictionary
- add or replace the id in the dictionary
- replace the dictionary contained in the
AdaptersFragment
.- use
bhomObject.AddFragment(adaptersFragment, true)
to replace the fragment.Since this involves a retrieve operation and quite few steps, it might be a performance hit. Also, it requires a few helper methods.
We could solve this with an utility method "modifyFragment" to modify the Dictionary stored there. But I'm not sure this is how we want Fragments to be.
All this to say I'm not sure I find it appropriate as a replacement of the CustomData.
This is essentially because Fragments are not supposed to be used this way: I think that fragments do not work well with collections of values which are supposed to shrink or expand, like the AdapterId.
3) An additional property of
IBHoMObject
.Pros:
Cons:
@al-fisher @rwemay @IsakNaslundBh @adecler @epignatelli
The text was updated successfully, but these errors were encountered: