次のコードがあります。
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
私の問題は、サブのパラメーター タイプを定義する方法がわからないことです。それらは毎回渡されるオブジェクトセットのタイプが異なるため、うまくいくと思いIObjectSet(Of EntityObject)
ましたが、次のエラーが発生します。
1[licensingModel.tblLookup_Country]' to type 'System.Data.Objects.IObjectSet
タイプ「System.Data.Objects.ObjectSet 1[System.Data.Objects.DataClasses.EntityObject]」 のオブジェクトをキャストできません</p>
誰かがこれに対する解決策を持っていますか?