Joe,
Although I have error trapping and logging code in my application, it was not logging anything. By replacing the line "Connection.ConnectionString = GetEntityConnection()" with "Connection.ConnectionString = My.Settings.EntitiesPprd", it worked correctly, then through process of elimination, I tracked it down to when you try to access a project via LinqPad, HttpContext.Current is not valid. Here is my GetConnectionString procedure.
Public Function GetEntityConnection() As String
Try
If HttpContext.Current.Server.MachineName = My.Settings.PROD Or My.Settings.ForceProdDb = "True" Then
Return My.Settings.HamptonEntitiesProd
End If
Return My.Settings.HamptonEntitiesPprd
Catch ex As Exception
NotifyOfError(ex)
End Try
End Function
Changing it to this works as expected now.
Public Function GetEntityConnection() As String
Try
If HttpContext.Current IsNot Nothing AndAlso HttpContext.Current.Server.MachineName = My.Settings.PROD Or My.Settings.ForceProdDb = "True" Then
Return My.Settings.EntitiesProd
End If
Return My.Settings.EntitiesPprd
Catch ex As Exception
NotifyOfError(ex)
End Try
End Function
I do know that checking for that condition should always be done, but this was just a small project and of course when you run it in Visual Studio, it launches its own IIS instance and HttpContext.Current would "always" exist when it would be hitting that part of the code.
Thanks.