views:

18

answers:

0

Building a little test application using ADO.NET Entity Framework, I've extended my auto-generated edmx data model classes. In particular, I've added a partial class to my Actors model

Partial Public Class Actors
    Implements IEquatable(Of Actors)

    .... 

    Public Sub refreshCountse()
        Dim q = (From p In Movies Where p.actlist.Contains(actor.name) Select p).Count()

    ...

    End Sub
End Class

In my added refreshCounts function, I'd like to retrieve some extra data from the database. Simple putting "Movies" into the query doesn't work. How to access the DB context in my class extension? Do I have to create an additional instance of my entities here?

In the auto-generated designer.vb class the context is created with

Public Sub New() MyBase.New("name=mytestDBEntities", "mytestDBEntities") OnContextCreated() End Sub

How can I access this instance of the mytestDBEntities object from within my own code?