<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
It needs the reference to get the connection object, which is used to
retrieve the<br>
layerdefinition and the name of the primary key column (the property
"IDs").<br>
<br>
There is also an overload that takes the runtime map instance.<br>
<br>
Feel free to write an overload that constructs the RuntimeMapLayer with
just a connection object instead.<br>
If you attach a patch to a ticket, I will put it in trunk.<br>
<br>
The runtime layer stuff is a bit clumsy, if you have ideas for
improvements, I'm all ears.<br>
<br>
Although that exception should not be able terminate the MgServer
service...<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Gunter Becker skrev:
<blockquote cite="mid:1248944832264-3355139.post@n2.nabble.com"
 type="cite">
  <pre wrap="">OK, initializing the RuntimeMapLayer works but after saving back the modified
map to the Session-Repository the MgServer service is terminated. I have to
restart the service and also the IIS.

When I debug my application I relize an error on the
RuntimeMapLayer.IDs-property:

     'runMapLayer.IDs' threw an exception of type 'System.Exception'
     Message: Cannot reload ID's because the layers parent is not set
     StackTrace: at
OSGeo.MapGuide.MaestroAPI.RuntimeClasses.RuntimeMapLayer.FindResourceIDs()
                      at
OSGeo.MapGuide.MaestroAPI.RuntimeClasses.RuntimeMapLayer.get_IDs()"        

So I've looked at the parent-property of the RuntimeMapLayer and it is set
to "null". Does this cause the problem? The parent-property is of type
MapDefinition and I'm wondering why I need a reference to the MapDefinition
at all?

What ist the best practice, when I want to add a new layer at runtime from
an exisiting MapDefinition in Library-Repository and which methode should I
use

Gunter



Gunter Becker wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Great, it works for me.

Thank you Kenneth




Kenneth Skovhede, GEOGRAF A/S wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Indeed it is.
You need to change line 1545 of the file 
MaestroAPI/Generated/LayerDefinition-1.3.0.cs
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Generated/LayerDefinition-1.2.0.cs#L1545">http://trac.osgeo.org/mapguide/browser/trunk/Tools/Maestro/MaestroAPI/Generated/LayerDefinition-1.2.0.cs#L1545</a>

Before:
public static readonly string SchemaName = "LayerDefinition-1.2.0.xsd";
After:
public static readonly string SchemaName = "LayerDefinition-1.3.0.xsd";

I will put that fix in trunk, but for now you can use it if you compile 
yourself.

This also means that you cannot save 1.3.0 layers from Maestro.

Regards, Kenneth Skovhede, GEOGRAF A/S



Gunter Becker skrev:
      </pre>
      <blockquote type="cite">
        <pre wrap="">Hi,

I'm trying to add a layer to the runtimemap using the MaestroAPI:
 
   MapLayerType layer = layerArray[layerName];
   RuntimeMapLayer runMapLayer = new RuntimeMapLayer(layer);
   runMap.Layers.Add(runMapLayer);

On creating the RuntimeMapLayer I get the following Error:

   error in XML document (2,117)

I suppose it's the same error like in this 
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/Can%27t-open-LayerDefinition-with-maestro-tt3276282.html#a3276282">http://n2.nabble.com/Can%27t-open-LayerDefinition-with-maestro-tt3276282.html#a3276282</a>
thread  and therefore I build the MaestroAPI.dll
from trunk as mentioned there. But the error still remains.

Any idea?

Thanks, Gunter


  
        </pre>
      </blockquote>
      <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


      </pre>
    </blockquote>
    <pre wrap="">
    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>