Problem with maxNumberOfItemsToReturn-Parameter

Posts   
 
    
andre
User
Posts: 14
Joined: 10-Jul-2007
# Posted on: 02-Aug-2007 15:43:13   

Hello

I have a problem with the maxNumberOfItemsToReturn Parameter, when I fetch a EntityCollection.

I want to have a generated Query that starts like this: "SELECT TOP 100 ... ".

When I build the RelationPredicateBucket without Relations, then the generated query contains the Top-Clausel. When I build the RelationPredicateBucket with Relations, the query doesn't contains the Top-Clausel.

My fetching looks like:


Using da As New DataAccessAdapter
   da.FetchEntityCollection(collection, filter, 100)
End Using

When I set relations in the filter the generated query didn't contains the Top-Clausel.

Best regards andré

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 02-Aug-2007 15:53:57   

Please post code snippets for both cases with the corresponding generated SQL queries.

andre
User
Posts: 14
Joined: 10-Jul-2007
# Posted on: 02-Aug-2007 16:26:56   

Code without Relation:


Dim archivMappeCollection As New EntityCollection(Of ArchivMappeEntity)
Dim filter As New RelationPredicateBucket

filter.PredicateExpression.Add(ArchivMappeFields.VorgangsNr = "0815")

Using da As New DataAccessAdapter
    da.FetchEntityCollection(archivMappeCollection, filter, 100)
End Using

generated query with Top-Clause:


SELECT TOP 100 
[CrossArchiv].[dbo].[tbl500].[C000] AS [F0], 
[CrossArchiv].[dbo].[tbl500].[C001] AS [F1], 
[CrossArchiv].[dbo].[tbl500].[C002] AS [F2], 
...

Code with Relation:


Dim archivMappeCollection As New EntityCollection(Of ArchivMappeEntity)
Dim filter As New RelationPredicateBucket

filter.Relations.Add(ArchivMappeEntity.Relations.ArchivDateiEntityUsingParentId, "ArchivDatei")
filter.PredicateExpression.Add(ArchivDateiFields.Dateiname.SetObjectAlias("ArchivDatei") = "test.dat")

Using da As New DataAccessAdapter
    da.FetchEntityCollection(archivMappeCollection, filter, 100)
End Using

generated query without Top-Clause:


SELECT 
[CrossArchiv].[dbo].[tbl500].[C000] AS [F0], 
[CrossArchiv].[dbo].[tbl500].[C001] AS [F1], 
[CrossArchiv].[dbo].[tbl500].[C002] AS [F2], 
...

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 03-Aug-2007 09:56:05   
andre
User
Posts: 14
Joined: 10-Jul-2007
# Posted on: 03-Aug-2007 10:29:09   

Oh sorry, I have overlooked this thread.