I agree that it can be surprising but this is not a bug. The Modeler only sees a usage if you explicitly select
Entity2. In your example, the entity
Entity2 is visualized twice but they are both showing derived information. If you change the association
Entity2_Entity1 to point to
AnotherEntity then both visualizations will suddenly change to
So, while it is not a bug, I can understand that it surprises you. Can you give a reason why it is problematic that these "usages" do not show up?
Update: Bart asks what happens if you delete
Entity2. If you delete
Entity2, you will not get an error about
Entity2 being undefined. You will get an error about the association
Entity2_Entity1 being undefined!
I thought about it some more and I realize now that it is the difference between languages with local variable type inference and without. Let's switch to traditional programming languages instead. In Java there is no type inference for local variables and the microflow translated to Java would look like this:
Entity1 entity1 = RetrieveFirstFromDatabase(Entity1.class); List<Entity2> entity2List = entity1.GetEntity2_Entity1(); for (Entity2 e: entity2List) System.out.println("bla");
Entity2 is used twice. However, in my favorite programming language C# there is type inference for local variables and the code looks like this:
var entity1 = RetrieveFirstFromDatabase<Entity1>(); var entity2List = entity1.GetEntity2_Entity1(); foreach (var e in entity2List) Console.WriteLine("bla");
There are no explicit usages of
Entity2. Also, when I ask Visual Studio to 'Find usages' of the class
Entity2 it finds none in this code fragment.
The Modeler also does type inference for local variables: you do not have to tell the Modeler what the type of the retrieve over association is; it is inferred. You also do not have to tell the Modeler what the type of the loop iterator is; it is inferred as well.
I think we can all be happy that the Modeler does not require us to specify all these types, but I would still like to hear about a use case where it is important to find these inferred usages of
Depending on how you define "usage" you could argue this is not a bug. In that case you would expect a warning for an object/list/something not being used in this microflow, does this warning occur?
edit: I personally agree with Georg here.