I have created a new Class in my own namespace and Import the DotNetNuke namespace into that. I would like to run a function that returns a filled class instance. My code looks like the following:
Public Function MW_ShoppingGetGeneralSettings(ByVal PortalID As Integer) As MWGeneralSettingsInfo
Dim myConnection As New SqlConnection(GetDBConnectionString)
Dim myCommand As SqlCommand = SqlCommandGenerator.GenerateCommand(myConnection, CType(MethodBase.GetCurrentMethod(), MethodInfo), New Object() {PortalID})
myConnection.Open()
Return CType(CBO.FillObject(myCommand.ExecuteReader(CommandBehavior.CloseConnection), GetType(MWGeneralSettingsInfo)), MWGeneralSettingsInfo)()
End Function
As you can see, I am grabbing an IDataReader and using the FillObject Method of the CBO to try to return a filled class.
the error I'm getting is "Class 'MyNamespace.MWGeneralSettingsInfo' cannot be indexed because it has no default property." - Though this bit of code LOOKS just like the code DNN uses to return a User object...