PerformGetDbCount

Posts   
 
    
TogasPoon
User
Posts: 42
Joined: 09-Feb-2006
# Posted on: 02-Nov-2007 21:49:53   
 Protected Sub dsOTS_PerformGetDbCount(ByVal sender As Object, ByVal e As SD.LLBLGen.Pro.ORMSupportClasses.PerformGetDbCountEventArgs) Handles dsOTS.PerformGetDbCount
    e.DbCount = dsOTS.EntityCollection.GetDbCount(e.Filter)
  End Sub

This is what I have for my PerformGetDbCount and it's working fine but I'm not sure it the most efficent way to get the count.

It basically generates these two sql calls

[shortend for simplicity]

SELECT * FROM vwOrderTracking WHERE ( ( [Intranet].[dbo].[vwOrderTracking].[StatusId] = 2))

SELECT COUNT(*) AS NumberOfRows FROM (SELECT * FROM [Intranet].[dbo].[vwOrderTracking] WHERE ( (StatusId = 2))) TmpResult

[/sfs]

What's the point of the first call?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Nov-2007 04:39:38   

The first is the query generated which will be placed inside the other one as the subquery, so there's just 1 query executed simple_smile

Set the _ORMPersistenceExecution _to 4, you'll then see the query executed

David Elizondo | LLBLGen Support Team