Files
tsEFCore8/bbdd.vb

22 lines
855 B
VB.net

Imports Microsoft.EntityFrameworkCore
Public Class bbdd
Public Shared Function ObtieneIPMysql(bd As DbContext) As String
Try
Dim sConexion As String = bd.Database.SqlQuery(Of String)($"select host from information_schema.processlist WHERE ID=connection_id();").ToList.First
Dim sIP As String = sConexion.Split(":")(0)
Return sIP
Catch ex As Exception
Return "** desconocida **"
End Try
End Function
Public Shared Function ObtieneIPSQLServer(bd As DbContext) As String
Try
Dim sIp As String = bd.Database.SqlQuery(Of String)($"select CONNECTIONPROPERTY('client_net_address') AS client_net_address;").ToList.First
Return sIp
Catch ex As Exception
Return "** desconocida **"
End Try
End Function
End Class