2

我有以下代码:

Private Sub setDropdowns()
    Using licensingModel As New licensingEntities
        SetUpDropdowns(licensingModel.tblLookup_Country, "CountryName", "CountryName", country)
        SetUpDropdowns(licensingModel.tblLookup_Country, "CountryName", "CountryName", bizCountry)
        SetUpDropdowns(licensingModel.tblLookup_Salutation, "SSalutation", "SSalutation", salutation)
        SetUpDropdowns(licensingModel.tblLookup_OrgType, "OrgType", "OTAuto", organisationType)
    End Using
End Sub

和子 SetUpDropdowns:

Private Sub SetUpDropdowns(ByVal entity As IObjectSet(Of EntityObject), ByVal textColumn As String, ByVal valueColumn As String, ByVal combo As RadComboBox)
    combo.DataSource = entity
    combo.DataBind()
End Sub

我的问题是我不知道如何为 sub 定义参数类型。因为它们是每次传递的不同类型的对象集,我认为IObjectSet(Of EntityObject)会起作用,但它给了我以下错误:

无法投射类型为“System.Data.Objects.ObjectSet 1[licensingModel.tblLookup_Country]' to type 'System.Data.Objects.IObjectSet1[System.Data.Objects.DataClasses.EntityObject]”的对象‌</p>

有人会为此提供解决方案吗?

4

1 回答 1

0

你不能只使用对象作为参数吗?

于 2012-04-12T20:49:41.933 回答