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.0Custom Business Objects and Data AccessCustom Business Objects and Data Access
Previous
 
Next
New Post
1/16/2007 1:18 PM
 
Thanks guys. This helped me a lot to verify my understanding of the DAL/CBO infrastructure and processes.
 
New Post
1/16/2007 6:57 PM
 

One other hazard of using the CBO.FillObject or CBO.FillCollection is that if your custom business object class defines any readonly properties (as I often like to do to return either combinations of properties or to test if multiple properties are null, etc.), the reflection used in these CBO methods becomes extremely inefficient.  I have not checked to see if this was changed in the later versions, but in 3.1, they would cause a silent exception to be thrown when the datareader did not contain an item with matching column name.

As far as hydrating complex properties, take a look at how the UserInfo class hydrates its Membership and Profile properties only when needed (when the property is first referenced).


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
1/17/2007 9:00 AM
 

in Performance, Performance, Performance Charles Nurse blogged about the performance hit of using the CBO (Custom Business Object) hydrator. He suggested creating your own custom hydrator.

In the Survey module I converted code such as this:

Public Shared Function GetSurveys(ByVal ModuleId As Integer) As List(Of SurveyInfo)
Return CBO.FillCollection(Of SurveyInfo)(DataProvider.Instance().GetSurveys(ModuleId))
End Function

To:

Public Shared Function GetSurveys(ByVal ModuleId As Integer) As List(Of SurveyInfo)
Dim SurveyInfolist As List(Of SurveyInfo) = New List(Of SurveyInfo)

Using dr As IDataReader = DataProvider.Instance().GetSurveys(ModuleId)
    While dr.Read
        Dim SurveyInfo As SurveyInfo = New SurveyInfo
        SurveyInfo.SurveyId = Convert.ToInt32(dr(
"SurveyId"))
        SurveyInfo.Question = Convert.ToString(dr(
"Question"))
        SurveyInfo.OptionType = Convert.ToString(dr(
"OptionType"))
        SurveyInfo.ViewOrder = Convert.ToInt32(ConvertNullInteger(dr(
"ViewOrder")))
        SurveyInfo.CreatedByUser = Convert.ToInt32(dr(
"CreatedByUser"))
        SurveyInfo.CreatedDate = Convert.ToDateTime(dr(
"CreatedDate"))
        SurveyInfolist.Add(SurveyInfo)
    End While
End
Using

Return
SurveyInfolist
End Function

Public
Shared Function ConvertNullInteger(ByVal Field As Object) As Integer
    If
Field Is DBNull.Value Then
        Return
0
    Else
        Return
Convert.ToInt32(Field)
    End If
End
Function



Michael Washington
http://ADefWebserver.com
www.ADefHelpDesk.com
A Free Open Source DotNetNuke Help Desk Module
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom Business Objects and Data AccessCustom Business Objects and Data Access


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