.netpartial-classesdataset-designer

Extend DataSet Class Not Working


I've created a dataset using the dataset designer. One of my tables is called Users and so there is a class called UsersDataTable. In this class are some properties, namely Connection. So I created a Partial Class UsersDataTable, but none of the routines, properties, or variables from the UsersDataTable class in the designer codebehind file are visible to me.

I'm simply trying to extend the class to add my own routines but leverage the connections and strong typing of the designer-generated class. I've tried creating my own partial classes and testing them to see if I have the problem with other classes and I don't. Only with these dataset designer-generated classes can I not access items in the other half of the partial class.

I'm working in .Net 4. What might I be doing wrong?


Solution

  • It seems as though I've just extended my class using the wrong identifiers:

    There is a Namespace and inside of the namespace is the Partial Public Class. Therefore my code of:

    Partial Public Class myData
        Partial Public Class UsersTableAdapter
            Public Function DoSomething() As String
                Return "Testing..."
            End Function
        End Class
    End Class
    

    was wrong...What I needed was:

    Namespace myDataTableAdapters
        Partial Public Class UsersTableAdapter
            Public Function DoSomething() As String
                Return "Testing..."
            End Function
        End Class
    End Namespace