agray1

Iworkspace.datasets(esridtgeo) returns only feature datasets

Discussion created by agray1 on Aug 29, 2011
Hi,
I have a bit of code where I want to cycle through all the geodatasets in a workspace.  In this particular case, a feature datasets and some standalone featureclasses.  The problem is none of the standalone featureclasses are being returned.

Private Sub SetProjection(ByVal featurework As IFeatureWorkspace, ByVal srWork As ISpatialReference)
    Dim work As IWorkspace = CType(featurework, IWorkspace)
    Dim datasets As IEnumDataset = work.Datasets(esriDatasetType.esriDTFeatureClass)
    Dim ds As IDataset = datasets.Next
    While ds IsNot Nothing
      m_logger.Debug("projecting : " & ds.Name)
      Dim gdsSchEdt As IGeoDatasetSchemaEdit = CType(ds, IGeoDatasetSchemaEdit)
      gdsSchEdt.AlterSpatialReference(srWork)
      ds = datasets.Next
    End While
  End Sub


If I look at the doc for esriDTGeo it says: "Any Geo Dataset."  Whatever that means.  a GeoDataset is not a class in ArcObjects.  IGeodataset is an interface and it is implemented by featureclasses.  So if "Any Geo Dataset" means any object in the workspace that implements IGeoDataset, then I would expect to get the stand-alone featureclasses.  Reliance on Igeodataset is perfect since I want to project the feature which relies on having a spatial reference and Igeodataset means the instance has a spatialref.
Any insight is welcome.  As a workaround I will make two calls to the get the featureclasses and the featuredatasets.  Lets hope my databases doesn't later get other types that need projecting.

Outcomes