Model not deleted with shape?!

Oct 30, 2012 at 8:40 PM
Edited Oct 30, 2012 at 8:41 PM

Hi,

I have 2 shapes on my diagram. Each of these shapes has a model object assigned. These 2 models are linked:

MyModel model1 = MyShape1.ModelObject as MyModel;
MyModel model2 = MyShape2.ModelObject as MyModel;
model1.Container = model2;

After I delete MyShape2 using "Delete with Model" menu, model1.Container does not become null - it still refers to the model2 object; I proved this using hash code. Is this behavior by design?! And if yes - am I supposed to unlink models explicitly?

Coordinator
Oct 31, 2012 at 9:37 AM

As the framework does not know anything about your model objects, their properties and their relationships, it cannot 'unlink' them by setting the 'Container' property to null.