Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0newbie object questionnewbie object question
Previous
 
Next
New Post
4/15/2008 12:04 PM
 

Embarrased:

If I create a class...

public class toads
private gen_toads as integer
private toads_color as string...

Public Property mgen_toads() As Integer
Get
return mgen_toads
End Get
Set(ByVal Value As Integer)
mgen_toads = Value
End Set
End Property
Public Property mtoads_color() As string...

end class

And I fill with dnn fill object...
        Public Shared Function FillObject(ByVal dr As IDataReader, ByVal objType As Type, ByVal ManageDataReader As Boolean) As Object

            Dim objFillObject As Object

            ' get properties for type
            Dim objProperties As ArrayList = GetPropertyInfo(objType)

            ' get ordinal positions in datareader
            Dim arrOrdinals As Integer() = GetOrdinals(objProperties, dr)

            Dim [Continue] As Boolean
            If ManageDataReader Then
                [Continue] = False
                ' read datareader
                If dr.Read() Then
                    [Continue] = True
                End If
            Else
                [Continue] = True
            End If

            If [Continue] Then
                ' create custom business object
                objFillObject = CreateObject(objType, dr, objProperties, arrOrdinals)
            Else
                objFillObject = Nothing
            End If

            If ManageDataReader Then
                ' close datareader
                If Not dr Is Nothing Then
                    dr.Close()
                End If
            End If

            Return objFillObject

        End Function

How do I refer to one member of the returned 3 toads?
Dim ctrlToads As New toadController
Dim infoToads As New toads
infoToads = ctrlToads.getAllToads()

'how do I best refer to member toad that has gen_toads = 3?

Thankyou

 
New Post
4/15/2008 2:11 PM
 

The easiest way to do this is to implement IHydratable (which is available starting with DNN 4.6.0).  This will cause you to create a Fill method that takes an IDataReader and a KeyID property that will return gen_toads in your case.  Then you can call FillDictionary instead of just FillObject, and it will create a dictionary that maps your toad objects to their gen_toads property.

Let me know if that makes sense and works for you,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/15/2008 2:26 PM
 

Thank you for your response.  
Ahh but I do still run 3.3.5 on some sites and would rather the older methods.  I cannot seem to find examples in other modules/core. 
I will look into and use iHydratable for later modules that will not need to be backwards compatible.

Still could use a tip.

Thanks again.

 

 
New Post
4/15/2008 3:48 PM
 

Well, I suppose it all depends on how you're creating the toads collection to start with.  I would probably build into the toads collection a way to lookup by gen_toads, probably making toads inherit from Dictionary<int, toad>.

Let me know if that makes sense, or if you need an example,


Brian Dukes
Engage Software
St. Louis, MO
866-907-4002
DNN partner specializing in custom, enterprise DNN development.
 
New Post
4/16/2008 7:52 AM
 

Thank you for your response.  
Ahh but I do still run 3.3.5 on some sites and would rather the older methods.  I cannot seem to find examples in other modules/core. 
I will look into and use iHydratable for later modules that will not need to be backwards compatible.

Still could use a tip.

Thanks again.

 

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0newbie object questionnewbie object question


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out