[mapguide-users] Get Identity Properties

Jamo adam.jamison at portbris.com.au
Thu Apr 2 02:37:57 EDT 2009


Incase anyone is interested I figured it out... I no longer have to hard code what the identity property is .

the following will read the feature reader and return the identity property allowing me now to create more dynamic commands :)

I haven't filled in all the select cases as I'm not sure whats what there.

      while (newFeatReader.ReadNext())
      {
        MgPropertyCollection idProps = new MgPropertyCollection();
        MgResourceIdentifier myRes = new MgResourceIdentifier(currentLayer.GetFeatureSourceId());

        foreach (MgPropertyDefinition IdPropDef in newFeatReader.GetClassDefinition().GetIdentityProperties())
          {
            switch (newFeatReader.GetPropertyType(IdPropDef.Name))
            {
              case 1:
             //   Response.Write("1");
                break;
              case 2:
             //   Response.Write("2");
                break;
              case 3:
             //   Response.Write("3");
                break;
              case 4:
              //  Response.Write("4");
                break;
              case 5:
             //   Response.Write("5");
                break;
              case 6:
              //  Response.Write("6");
                break;
              case 7:
                idProps.Add(new MgInt32Property(IdPropDef.Name, newFeatReader.GetInt32(IdPropDef.Name)));
               // Response.Write("7");
                break;
              case 8:
              //  Response.Write("8");
                break;
              case 9:
              //  Response.Write("9");
                break;
              default:
              //  Response.Write("no valid type");
                break;
            }
          }
        MgSelection sel = new MgSelection();
        sel.AddFeatureIds(currentLayer, currentClassName, idProps);
        String selText = EscapeForHtml(sel.ToXml());

//do additional stuff with feature here....
}


-- 
View this message in context: http://n2.nabble.com/Get-Identity-Properties-tp2567438p2573602.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list