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 CBO not working, conversion failures..Custom CBO not working, conversion failures..
Previous
 
Next
New Post
2/18/2009 5:04 PM
 

Since I'm dealing with a lot of data I'm trying to aviod the reflection based hydrators. My tables that have a single integer key are using iHydratable adn that's working fine. For the multiple key tables it's not, as those are done in the controller.

                Using dr As IDataReader = DataProvider.Instance().ListPeaks(portalId)
                    While dr.Read
                        Dim PeakInfo As PeakInfo = New PeakInfo
                        PeakInfo.PeakDate = Convert.ToDateTime(Null.SetNull(dr.Item("PeakDate"), PeakInfo.PeakDate)) <-Charles syntax
                        PeakInfo.PeakDate = Convert.ToDateTime(Null.SetNull(dr.Item("PeakDate")) <- Michael's syntax (both fail)
                       PeakInfo.PeakServiceGroup = Convert.ToString(Null.SetNull(dr.Item("PeakServiceGroup")))
                        PeakInfo.PortalId = Convert.ToInt32(Null.SetNull(dr.Item("PortalId")))
                        PeakInfo.PeakExecutions = Convert.ToInt32(Null.SetNull(dr.Item("PeakExecutions")))
                        PeakInfo.TotalResponse = Convert.ToDecimal(Null.SetNull(dr.Item("TotalResponse")))
                        PeakInfo.PeakResponse = Convert.ToDecimal(Null.SetNull(dr.Item("PeakResponse")))
                        PeakInfolist.Add(PeakInfo)
                    End While

The examples from Charles and Michael differ, I've noted the differences in the conversions for PeakDate. Unfortunately both fail. The format shown in the 2nd example (michaels) works fine in the Info module iHydrator. In the business controller I get the error "Unable to cast object of type 'System.DateTime' to type 'System.Reflection.PropertyInfo'.". I both in need of a solution, and a explanation of the two differnet methods so I can understand what I'm up to.

 
New Post
2/19/2009 9:03 AM
 

IF you build your own custom module, you should use a CBO reflection, firstly it save times and less code.
Note: each data that has been retrieved using this reflection, you can put a cache, so it wil only do once. Remember to clear the cache everytime you update or add new data.

let me know what you think.

 
New Post
2/19/2009 10:31 AM
 

I am bypassing reflection imtentionally because it is very ineffecient when processing volumes of data. Bypassing reflection is a documented performanec boost, see articles by Charles Nurse and Michael Washington.

In any case fewer lines of code in your programs doesn't mean fewer lines of code executed, which is my point. If you look at CBO reflection there's quite a bit of activity that I need to aviod. My modules aren't dealing with a few hundred rows, but in some cases several thousand and the performance hit from CBO is impractical.

 
New Post
2/19/2009 10:47 AM
 

I can't completely explain why the code below works but the code above doesn't, and I'd still like some comments along those lines, but after much pain and testing, the following code snippet works:

Using dr As IDataReader = DataProvider.Instance().ListPeaks(portalId)
  While dr.Read
  Dim objPeakInfo As PeakInfo = New PeakInfo
    With objPeakInfo
      .PeakDate = Convert.ToDateTime(Null.SetNull(dr.Item("PeakDate"), .PeakDate))
      .PeakServiceGroup = Convert.ToString(Null.SetNull(dr.Item("PeakServiceGroup"), .PeakServiceGroup))
      .PortalId = Convert.ToInt32(Null.SetNull(dr.Item("PortalId"), .PortalId))
      .PeakExecutions = Convert.ToInt32(Null.SetNull(dr.Item("PeakExecutions"), .PeakExecutions))
      .TotalResponse = Convert.ToDecimal(Null.SetNull(dr.Item("TotalResponse"), .TotalResponse))
      .PeakResponse = Convert.ToDecimal(Null.SetNull(dr.Item("PeakResponse"), .PeakResponse))
      PeakInfolist.Add(objPeakInfo)
    End With
  End While
End Using
 

 
New Post
2/19/2009 4:36 PM
 

Hi Keith on the top codes, can you declare the object as follow:
Dim objPeakInfo As PeakInfo = New PeakInfo Instead of Dim PeakInfo As PeakInfo = New PeakInfo

See if the code works.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Custom CBO not working, conversion failures..Custom CBO not working, conversion failures..


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