Need help creating an IName object describing a Workspace, Dataset and FeatureClass

Discussion created by bjones2 on Mar 23, 2011
Latest reply on Mar 24, 2011 by bjones2
As part of a custom plug-in data source, I am required to implement the IParseNameString CanParse() and Parse() methods.

The Parse() method will receive a string such as the following:
Where :
  F:\arctest\plugindata is the path to the workspace containing my feature data set.
  points is the feature data set. On disk it is points.csp
  Polygon is the name of a feature class within points.csp that I am interested in. This particular sample dataset contains 12 feature classes.

It is the job of the Parse() method to return an IName objects describing the workspace, dataset and presumably the featureclass represented by the incoming string.

FYI, his data set can be found in the ArcObjects SDK in C:\Program Files (x86)\ArcGIS\DeveloperKit10.0\Samples\data\SimplePointData.

The code below will allow my plug-in data source to successfully open the points.csp data set but will always result in the opening of the first feature class within points.csp rather than the one named Polygon. I assume that this is due to the fact that nowhere in the code below have I specified Polygon as the feature class name to use. Simply put, I don't know how.

To keep things simple, no actual parsing yet. Just hard coded paths.

Any tips on what I need to do would be appreciated.

    public IName Parse(string ParseName)

        // Incoming ParseName string is:
        //  F:\arctest\plugindata\points\Polygon
        // Where :
        //  "F:\arctest\plugindata" is the workspace directory
        //  "points" is the feature dataset. On disk it is points.csp
        //  "Polygon" is the name of the feature class withing points.csp

        IWorkspaceName workspaceName = new WorkspaceNameClass();
        workspaceName.WorkspaceFactoryProgID = "esriGeoDatabase.SimplePointPluginWorkspaceFactory";  // My plugin factory
        workspaceName.PathName = "F:\\arctest\\plugindata"; // Path of the directory containing my dataset

        IFeatureClassName fcName = new FeatureClassNameClass();
        fcName.FeatureType = esriFeatureType.esriFTSimple;
        fcName.ShapeType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon;
        fcName.ShapeFieldName = "SHAPE";

        IDatasetName dsName = (IDatasetName)fcName;
        dsName.Name = "points"; // The dataset to open (points.csp on disk)
        dsName.WorkspaceName = workspaceName;
        // What about Polygon? which is one of 12 feature classes in the points.csp dataset and the one I want to open

        return (IName)fcName;