The below example shows how to implement a Repository of objects in a generic fashion. (This is the VB.NET version of my previous GIST) This was adapted and simplified from this article: https://code.msdn.microsoft.com/generic-repository-pattern-ddea2262
The point of this code is to allow the generic access to any object type in the datastore without the need to define a repository for each object. It is important to note that, although the below examples should work as is, it is recommended to make use of a dependency injection framework as database connection limits are not considered.