VS2017中的VB.Net函数重载解决问题

时间:2018-07-06 10:04:24

标签: vb.net visual-studio-2017

将vb.net项目从VS2010迁移到VS 2017时,由于函数重载分辨率不正确,我们丢失了参考错误

JS  **************************项目1 ********************** *********

Imports Microsoft.Practices
Imports Microsoft.Practices.EnterpriseLibrary.Data
Public MustInherit Class DataLayerSQLBase
    Private m_factory As EnterpriseLibrary.Data.DatabaseProviderFactory
    Private m_database As Microsoft.Practices.EnterpriseLibrary.Data.Database
    Public Function ExecuteReader(ByVal spName As String) As IDataReader
        m_database = m_factory.CreateDefault
        Return ExecuteReader(m_database, spName)
    End Function
    Public Function ExecuteReader(ByVal spName As String, ByVal secondparam As String) As IDataReader
        m_database = m_factory.CreateDefault
        Return ExecuteReader(m_database, spName)
    End Function
    Public Function ExecuteReader(ByVal database As EnterpriseLibrary.Data.Database, ByVal spName As String) As IDataReader
        Dim m_Command = database.GetStoredProcCommand(spName)
        m_Command.CommandTimeout = 300
        Return m_Command.ExecuteReader
    End Function

End Class

****************************项目1 ******************* ************  **************************项目2 ********************** *********

该项目引用项目1,并且没有Enterprise.Library.Data.dll引用,因此无法在VS2017中进行编译,要求添加引用,但在VS2010中可以运行而无需添加引用

Imports ClassLibrary1
Public Class Class3
    Inherits DataLayerSQLBase
    Public Sub Test()
        MyBase.ExecuteReader("aaaa", "aaaaa")
    End Sub
End Class

0 个答案:

没有答案