Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

How to wrap SmartInspectLinqToSqlAdapter into Action(of String)


#1

Hey
I use your product quite a while. Now I have updated my Project to Entity Framework 5 and there, the logging mechanism has changed to:

Public Property Log As Action(Of String)

Now to this property I can’t bind the SmartInspectLinqToSqlAdapterClass anymore.
Could you please help me to fix this Problem!?
THX a lot in advice


#2

Hey - I was able to get it working, but not as expected… :confounded:

What I did now, is as follows:

 Public Sub LogLinQ(toLog As String) Implements ILogger.LogLinQ
    If String.IsNullOrEmpty(toLog.Trim)=False then
        SiAuto.Main.LogMessage(title)        
    End If
End Sub

And to Register I do the following:

myContext.Database.Log = AddressOf myLogging.LogLinQ

When I now do something like this:

Dim myResult = (From myQuery in myContext.Customers Select myQuery).ToList

Then I get 5 calls of theMethod.

  1. Open Connection
  2. Query
  3. Execution
  4. Completed
  5. Close Connection

This isn’t smooth… Do you know a better way?
THX


#3

Hello,

Thanks for your posting. We are not aware of a better way unfortunately but you could look into writing a separate wrapper just for EF 5 and you could look into using one of our adapters/wrappers as a starting point.

Cheers,
Tobias