IPredicateExpression filter = new PredicateExpression(ReqMastFields.QA_Date == DBNull.Value);
filter.AddWithAnd(ReqMastFields.Void == 0);
filter.AddWithAnd(ReqMastFields.VoidDate == DBNull.Value);
filter.AddWithAnd(ReqMastFields.VoidUser == DBNull.Value);
ReqMastCollection reqMastCollection = new ReqMastCollection();
IPredicateExpression groupFilter = new PredicateExpression(
OnlineClientGroupFields.OnlineGroupInfoId== SessionData.UserToken.OnlineGroupInfoID);
filter.AddWithAnd(new FieldCompareSetPredicate(
ReqMastFields.ClientId, OnlineClientGroupFields.ClientId, SetOperator.In, groupFilter));
return (int)reqMastCollection.GetScalar(ReqMastFieldIndex.Id, null, AggregateFunction.Count, filter);
Any idea why that would create two queries?
Query: SELECT [Bai].[dbo].[OnlineClientGroup].[ClientId] FROM [Bai].[dbo].[OnlineClientGroup] WHERE ( [Bai].[dbo].[OnlineClientGroup].[OnlineGroupInfoId] = @OnlineGroupInfoId2)
Parameter: @OnlineGroupInfoId2 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 16.
Query: SELECT TOP 1 COUNT([Bai].[dbo].[ReqMast].[Id]) AS [Id] FROM [Bai].[dbo].[ReqMast] WHERE ( [Bai].[dbo].[ReqMast].[QA_Date] IS NULL AND [Bai].[dbo].[ReqMast].[Void] = @Void1 AND [Bai].[dbo].[ReqMast].[VoidDate] IS NULL AND [Bai].[dbo].[ReqMast].[VoidUser] IS NULL AND [Bai].[dbo].[ReqMast].[ClientId] IN (SELECT [Bai].[dbo].[OnlineClientGroup].[ClientId] FROM [Bai].[dbo].[OnlineClientGroup] WHERE ( [Bai].[dbo].[OnlineClientGroup].[OnlineGroupInfoId] = @OnlineGroupInfoId2)))
Parameter: @Void1 : Boolean. Length: 0. Precision: 1. Scale: 0. Direction: Input. Value: 0.
Parameter: @OnlineGroupInfoId2 : Int32. Length: 0. Precision: 10. Scale: 0. Direction: Input. Value: 16.