snaperski

Workspace Extension to make table invisible to user

Discussion created by snaperski on May 7, 2013
Latest reply on May 15, 2013 by snaperski
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

Outcomes