Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

AspDotNetStoreFront
  Ads  
Engage Software - Training Partner for DotNetNuke
 


  Sponsors  

Meet Our Sponsors

.: CounterSoft :.
telerik
ExactTarget email software solutions
Merak Mail Server
WebSecureStores -- ASP.NET & DotNetNuke Hosting Solutions
FCKeditor Project
 


DotNetNuke Forums
 
  Forum  General DotNetN...  Extend It! ( Pr...  newbie object question
Previous Previous
 
Next Next
New Post 4/15/2008 10:04 AM
User is offline sStock
2 posts
10th Ranked


newbie object question 

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 12:11 PM
User is offline Brian Dukes
477 posts
www.engagesoftware.com
8th Ranked


Re: newbie object question 

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
314.966.4000

The leading provider of DotNetNuke support, training and custom module development.
 
New Post 4/15/2008 12:26 PM
User is offline sStock
2 posts
10th Ranked


Re: newbie object question 

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 1:48 PM
User is offline Brian Dukes
477 posts
www.engagesoftware.com
8th Ranked


Re: newbie object question 

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
314.966.4000

The leading provider of DotNetNuke support, training and custom module development.
 
Previous Previous
 
Next Next
  Forum  General DotNetN...  Extend It! ( Pr...  newbie object question
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Multipartner Virtual Data Rooms
The Virtual Data Rooms (VDR) provided by an expert advisor, far from any ordinary software company!, supporting the sellers and their consultants. Multipartner builds and services higly professional Virtual Data Rooms (VDR) specifically tailored to M&A, Real Estate and NPL deals.
www.multipartner.com
DNN SEO
Seablick Consulting specializes in DNN search engine optimization (SEO), DNN consulting, as well as support & training.
seablick.com
Intura Vision / Intura Enterprise
Point-of-Sale and business management applications targeted towards quick service, fast casual and delivery-based restaurant concepts.
www.intura.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP