Unable to bind layer information in Model

I am trying to make layerName binding two way but it’s not working.
Can we bind layer information in the model so that it can be retained for the next time while loading a model we can use layers data from model.

Yes, that should work. Make sure the binding is at the part level and not on some nested GraphObject.

new go.Binding("layerName", "layer").makeTwoWay(),

Not working, tried at every level of part. Also i need different layers for Background, Entity and Entity selection Adornment. So i am creating 3 Layers and selection adornments are part of different layer than its entity.

How isn’t it working? If you inspect the .layerName, it doesn’t update? Or something else?

layer name is not coming in the model.
this is how i am using it.

this.diagram.addLayerAfter($(go.Layer, { name: "BlockLayer" }), this.diagram.findLayer("Background"));
this.diagram.addLayerAfter($(go.Layer, { name: "ProductLayer" }), this.diagram.findLayer("BlockLayer"));
var xorTemplate =
        $(go.Node,
          { dragComputation: stayInFixedArea, layerName:"ProductLayer" },
          new go.Binding("layerName", "layer").makeTwoWay(),
          {
            selectionAdornmentTemplate:  // custom selection adornment: a blue rectangle
            $(go.Adornment, "Spot", 
            $(go.Placeholder),
            $(go.Shape, "RoundedRectangle",
              {
                stroke: "green",
                strokeWidth: 1,
                height: 150,
                width: 300,
                fill:"rgba(255,255,255, 0.5)"
              }),
              $(go.Shape, "RoundedRectangle",
              {
                stroke: "green",
                height: 300,
                width: 150,
                fill:"rgba(255,255,255, 0.5)"
              }),
              $(go.Shape, "Rectangle",
              {
                stroke: "green",
                height: 150,
                width: 150,
                fill:"rgba(234, 250, 241, 0.5)"
              })
            ),
            //selectionChanged: selectionChanged
          },  
          new go.Binding("angle").makeTwoWay(),
          "Spot", nodeStyle(),
          $(go.Shape, "XorGate", shapeStyle()),
          $(go.Shape, "Rectangle", portStyle(true), 
            { portId: "in1", alignment: new go.Spot(0.26, 0.3) }),
          $(go.Shape, "Rectangle", portStyle(true),
            { portId: "in2", alignment: new go.Spot(0.26, 0.7) }),
          $(go.Shape, "Rectangle", portStyle(false),
            { portId: "out", alignment: new go.Spot(1, 0.5) }),            
          // { rotatable: true, rotateObjectName: "XorGate" },
          // { resizable: true, resizeObjectName: "XorGate" }
        );

If you press the Move to Background button, you’ll see that Alpha’s data is properly updated from Foreground to Background. I’m not sure what you’re doing differently.