dalManager.GetProvider() - System.NotImplementedException

dalManager.GetProvider() - System.NotImplementedException

Old forum URL: forums.lhotka.net/forums/t/11171.aspx


gajit posted on Friday, February 17, 2012

OK, so I've made _some_ progress in my attempts to put together the necessary classes, etc in Vb.Net.

I've now recreated a simple EncapsulatedInvoke-type Windows FORMS application and all seemed to be going well.

Until now.

When I try to retrieve a personList, which is being executed in the Dataportal_Fetch method of my Library.Net.PersonList class.

 

I get a

System.NotImplementedException

My Fetch looks like this:

    Private Overloads Sub DataPortal_Fetch()

        IsReadOnly = False

        Dim rlce = RaiseListChangedEvents

        RaiseListChangedEvents = False

        Using dalManager = DataAccess.DalFactory.GetManager()

            Dim dal = dalManager.GetProvider(Of DataAccess.IPersonDal)() '----< error is here!!

            Using data = dal.Fetch()
                While data.Read()
                    Dim item = DataPortal.FetchChild(Of PersonInfo)(data)
                    Add(item)
                End While
            End Using
        End Using
        RaiseListChangedEvents = rlce
        IsReadOnly = True

    End Sub

It definitely gets the correct dalManager and my IPersonDal looks like this:

 Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Data


Public Interface IPersonDal

    Function Fetch() As IDataReader
    Function Fetch(id As Integer) As IDataReader
    Function Insert(firstName As String, lastName As String) As Integer
    Sub Update(id As Integer, firstName As String, lastName As String)
    Sub Delete(id As Integer)

End Interface

 

 Any ideas?

Thanks,

Graham

 

 

 

 

 

 

gajit replied on Friday, February 17, 2012

Never mind.

 

I'm an Idiot.

 

PersonDal did not exist in my Mock assembly.

Duh....

 

tmg4340 replied on Friday, February 17, 2012

Well - presuming this code is using what you published in previous posts, my first thought is whether the "NotImplementedException" is coming from your GetProvider() method because it can't construct the type you're asking for.  The code you posted throws this very exception in that event.

HTH

- Scott

Copyright (c) Marimer LLC