Hi,
please consider 3 scenarios in which we want to create instances of BPMN.Element and at the same time set their BPMN.Element.ID property:
new BPMN.Element { ID = "task", TypeName = "sendTask", ParentID = "process" } This code sets the ID of the element to the expected value ("task").
new BPMN.Element { ID = "mes", TypeName = "messageFlow", ParentID = "process", Attributes = new Dictionary<string, string>() { ["sourceRef"] = "task1", ["targetRef"] = "task" } }
This code sets the ID property incorrectly to null. Please note that here I use BPMN.Elements.Attibutes to set some additional attributes.
new BPMN.Element { TypeName = "messageFlow", ParentID = "process", Attributes = new Dictionary<string, string>() { ["id"] = "mes", ["sourceRef"] = "task1", ["targetRef"] = "task" } }
This code sets the ID property to the expected value ("mes"), Note that I set the ID explicitly in the BPMN.Elements.Attibutes dictionary.
It seems that initializing BPMN.Element.Attributes disregards ID property that is supposed to be set.
IMHO it's a small flaw in the API. Definitely it isn't a major bug but it would be nice to fix this inconsistency, especially in the context of unit testing.
BPMN.View version: 1.0.6 (Nuget package)
Hi, please consider 3 scenarios in which we want to create instances of BPMN.Element and at the same time set their BPMN.Element.ID property:
new BPMN.Element { ID = "task", TypeName = "sendTask", ParentID = "process" }
This code sets the ID of the element to the expected value ("task").new BPMN.Element { ID = "mes", TypeName = "messageFlow", ParentID = "process", Attributes = new Dictionary<string, string>() { ["sourceRef"] = "task1", ["targetRef"] = "task" } }
This code sets the ID property incorrectly to null. Please note that here I use BPMN.Elements.Attibutes to set some additional attributes.new BPMN.Element { TypeName = "messageFlow", ParentID = "process", Attributes = new Dictionary<string, string>() { ["id"] = "mes", ["sourceRef"] = "task1", ["targetRef"] = "task" } }
This code sets the ID property to the expected value ("mes"), Note that I set the ID explicitly in the BPMN.Elements.Attibutes dictionary.It seems that initializing BPMN.Element.Attributes disregards ID property that is supposed to be set.
IMHO it's a small flaw in the API. Definitely it isn't a major bug but it would be nice to fix this inconsistency, especially in the context of unit testing. BPMN.View version: 1.0.6 (Nuget package)