Workspace Extension to make table invisible to user

583
1
05-07-2013 03:37 AM
RaivoAlla
New Contributor II
Hello!

We have growing need to implement a scenario where user can't see specific table in a workspace, but  - via our Arcmap class library - is able to insert rows to the table; that is done programmatically and is generally unobservable process to the user. 

Firstly - is it possible to do so?

Secondly, it seems that the proper solution would be to build workspace extension by using PrivateDatesetNames property.
But I have problem defining a suitable ENUMBSTR class for that (in VB.NET). This one  is what I have:
 
Public NotInheritable Class MyEnumBSTR
    Implements IEnumBSTR
    Private _index As Integer = 0
    Private _strings As New List(Of String)()
    Private Const S_FALSE As Integer = 1

    Public Sub Add(ByVal strVal As String)
        _strings.Add(strVal)
    End Sub
    Public Sub New(ByVal tbls As String())
        For Each str As String In tbls
            Add(str)
        Next

    End Sub
    Public Sub Reset() Implements IEnumBSTR.Reset
        _index = 0
    End Sub
    Public Function [Next]() As String Implements IEnumBSTR.Next
        If _index > _strings.Count Or _index < 1 Then
            [Next] = ""
            Err.Raise(S_FALSE)
        Else
            [Next] = _strings.Item(_index)
            _index = _index + 1
        End If
    End Function
End Class


...and  property in my extension class:
    Public ReadOnly Property PrivateDatasetNames(ByVal datasetType As esriDatasetType) As IEnumBSTR _
    Implements IWorkspaceExtension.PrivateDatasetNames, IWorkspaceExtension2.PrivateDatasetNames
        Get
            Dim hiddenTables() As String = New String() {"table1"}
            Dim enumBSTR As IEnumBSTR = CType(New MyEnumBSTR(hiddenTables), IEnumBSTR)
            Return enumBSTR
        End Get
    End Property


Now, I have made sure that this extension is really registered for a certain .gdb geodatabase and even MyEnumBSTR.Add method has been called... but I still can see that table in ArcCatalog and in ArcMap.

Is there something that I have somehow looked over?

Best regards,
Raivo Alla,
Estonian Land Board
0 Kudos
1 Reply
RaivoAlla
New Contributor II
Luckily I found solution, my pFeatClassName was declared abit carelessly, in case anyone will find it useful:
            Dim targetWorkspaceIName As IName = CType(TempWorkspaceName, IName)
            Dim targetWorkspace As IWorkspace = CType(targetWorkspaceIName.Open(), IWorkspace)
            Dim pFeatClassName As IFeatureClassName = New FeatureClassNameClass()
            With (pFeatClassName)
                .FeatureType = esriFeatureType.esriFTSimple
                .ShapeFieldName = "Shape"
                .ShapeType = esriGeometryType.esriGeometryPolyline
            End With
            Dim targetDatasetName As IDatasetName = CType(pFeatClassName, IDatasetName)
            targetDatasetName.Name = "tervikteed"
            targetDatasetName.WorkspaceName = TempWorkspaceName  


Thanks;)
Raivo
0 Kudos