Hi Carl,

I don't believe the Feature Service supports modifying feature schemas so you'd 
have to use the FDO API. The steps for the managed API would be something like:

        IConnection conn;
        // ... create and open connection to provider
      IDescribeSchema descSchema = 
conn.CreateCommand(CommandType.CommandType_DescribeSchema) as IDescribeSchema;
      FeatureSchemaCollection schemas = descSchema.Execute();

        FeatureSchema schema = schemas["myschema"];
        FeatureClass featClass = new FeatureClass("newClass", "description");
        // ... add properties to the new class.
        ClassCollection classes = schema.Classes;
      classes.Add(featClass);

      IApplySchema applySchema = 
conn.CreateCommand(CommandType.CommandType_ApplySchema) as IApplySchema;
      applySchema.FeatureSchema = schema;
      applySchema.Execute();

You can also create a new feature schema by instantiating a new FeatureSchema 
object, optionally populating it with classes and passing it to an IApplySchema 
command.

Note that not all providers support multiple feature schemas (SDF is limited to 
just one per file).

Brent.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carl Jokl
Sent: Tuesday, July 15, 2008 9:01 AM
To: [email protected]
Subject: [mapguide-users] Adding a new feature class to an already existing 
feature schema


I wondered if anyone knows how to programatically add a new feature class
definition to an existing feature schema. All the example code I have goes
on the basis of creating the new class and the schema together in one step
but I don't have any examples of how to go about retrospectively adding a
new class to an existing feature schema.

I have so far got to the point of getting hold of an instance of the feature
service and using the DescribeSchema method to retrieve the schema I wish to
add to. I can get hold of the schema's class collection and add the new
class to this but I am not sure if that will persist the new feature class
or if I have to somehow persist the changes to the schema after adding the
new class to it.

Has anyone done this / know how it needs to be done?
--
View this message in context: 
http://www.nabble.com/Adding-a-new-feature-class-to-an-already-existing-feature-schema-tp18464689p18464689.html
Sent from the MapGuide Users mailing list archive at Nabble.com.

_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to