Exclude fields seems to be wiping some none exclude fields.

Posts   
 
    
BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 24-Feb-2010 18:34:18   

Hello!

I have a function that returns quite a large related entity collection that had lots of xml fields, so I have created a ExcludeIncludeFieldsList to exclude all the xml columns.

The function is as follows:

  public static EntityCollection GetAssignedOrders(int count, bool unassigned, ConfigManager configuration, Guid currentUserVal, Guid printstationid)
        {

            ExcludeIncludeFieldsList documentExcludedFields = new ExcludeIncludeFieldsList();
            documentExcludedFields.Add(DocumentFields.ProductXml);

            ExcludeIncludeFieldsList productExcludedFields = new ExcludeIncludeFieldsList();
            documentExcludedFields.Add(ProductFields.ProductXml);

            ExcludeIncludeFieldsList orderDetailExcludedFields = new ExcludeIncludeFieldsList();
            orderDetailExcludedFields.Add(OrderDetailFields.ProductXml);


            EntityCollection staffPortals = PrintstationManager.GetStaffPortals(currentUserVal);
            EntityCollection printStationPortals = PrintstationManager.GetPrintStationPortals(printstationid);

            EntityCollection col = new EntityCollection(new OrderDetailEntityFactory());
            if (staffPortals.Count == 0 && printStationPortals.Count == 0)
            {
                //return nothing
                return col;
            }
            IRelationPredicateBucket bucket = new RelationPredicateBucket();

            IPredicateExpression quoteFilter = QuoteNotRequiredFilter();
            IPredicateExpression approvalFilter = ApprovalNotRequiredFilter();

            PredicateExpression portalfilter = new PredicateExpression();
            foreach (PrintStationStaffPortalEntity ent in staffPortals)
            {
                portalfilter.AddWithOr(PortalFields.PortalId == ent.PortalId);
            }
            foreach (PrintStationPortalEntity ent in printStationPortals)
            {
                portalfilter.AddWithOr(PortalFields.PortalId == ent.PortalId);
            }

            bucket.Relations.Add(OrderDetailEntity.Relations.OrderEntityUsingOrderId);
            bucket.Relations.Add(OrderDetailEntity.Relations.ProductEntityUsingProductId);
            bucket.Relations.Add(OrderDetailEntity.Relations.OrderDetailStatusEntityUsingOrderDetailStatusId);
            bucket.Relations.Add(OrderDetailEntity.Relations.PriceQuoteEntityUsingOrderDetailId, JoinHint.Left);
            bucket.Relations.Add(PortalEntity.Relations.OrderEntityUsingPortalId);
            bucket.PredicateExpression.AddWithAnd(portalfilter);
            bucket.PredicateExpression.Add(OrderFields.PendingConfirmation == false);
            if (!unassigned)
            {
                bucket.PredicateExpression.Add(OrderDetailFields.PrintstationId != DBNull.Value);
            }

            bucket.PredicateExpression.Add(approvalFilter);
            bucket.PredicateExpression.AddWithAnd(quoteFilter);
            bucket.PredicateExpression.Add(OrderDetailStatusFields.ShowPrintStation == true);


            PrefetchPath2 prefetch = new PrefetchPath2((int)EntityType.OrderDetailEntity);
            prefetch.Add(OrderDetailEntity.PrefetchPathDocument,documentExcludedFields);
            prefetch.Add(OrderDetailEntity.PrefetchPathOrder).SubPath.Add(OrderEntity.PrefetchPathUser);
            prefetch.Add(OrderDetailEntity.PrefetchPathOrderDetailStatus);
            prefetch.Add(OrderDetailEntity.PrefetchPathProduct,productExcludedFields);

            using (DataAccessAdapter a = new DataAccessAdapter())
            {
                a.FetchEntityCollection(col, bucket, count, null, prefetch, ProductXmlExcludedFieldsList());
            }

            return col;
        }

this is rather a large function but hopefully you can make basic sense of it. My problem is my document entity is having problems. It has a column in it called "OriginalExtension" when I use the documentExcludeFields on the prefectch

         prefetch.Add(OrderDetailEntity.PrefetchPathDocument,documentExcludedFields);

OriginalExtension comes through as an empty string. If I remove the exclude fields it appears as it should.

This seems like a bug as I cannot work out what I am doing that would cause this. The rest of the columns seem to be ok.

Can you suggest what I need to do to rectify this? Or what else I can send you that may point towards the problem?

Thanks

Bex

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Feb-2010 05:42:15   
David Elizondo | LLBLGen Support Team
BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 25-Feb-2010 10:37:27   

Hello!

I am using LLBLGen 2.6 (final) adapter

If I put the exclude fields just on the normal fetch like this:


public static EntityCollection GetAllDocumentsWithProductXmlExcluded()
        {
            EntityCollection col  = new EntityCollection(new DocumentEntityFactory());
            ExcludeIncludeFieldsList documentExcludedFields = new ExcludeIncludeFieldsList();
            documentExcludedFields.Add(DocumentFields.ProductXml);

            using(DataAccessAdapter adapter = new DataAccessAdapter())
            {
                adapter.FetchEntityCollection(col,documentExcludedFields,null);
            }
            return col;
        }

The column "originalExtension" returns correctly and the sql produced is:

SELECT [dbo].[Document].[DocumentId], [dbo].[Document].[LibraryId], [dbo].[Document].[FileName], [dbo].[Document].[Description], [dbo].[Document].[OriginalExtension], [dbo].[Document].[FinalExtension], [dbo].[Document].[StatusId], [dbo].[Document].[CreatedDate], [dbo].[Document].[UpdateDate], [dbo].[Document].[MissingFonts], [dbo].[Document].[NumberOfPages], [dbo].[Document].[FileTypeId], [dbo].[Document].[LastOrderedDate], [dbo].[Document].[FileSize], [dbo].[Document].[ErrorMessage], [dbo].[Document].[UploadedBy], [dbo].[Document].[ProductId], [dbo].[Document].[ThumbnailsCreated] FROM [dbo].[Document]

With the above query the entire output produced is:

The thread 0xa94 has exited with code 0 (0x0). Method Enter: CreatePagingSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ Generated Sql query: Query: SELECT [dbo].[OrderDetail].[OrderDetailId], [dbo].[OrderDetail].[ShortOrderDetailId], [dbo].[OrderDetail].[OrderId], [dbo].[OrderDetail].[DocumentId], [dbo].[OrderDetail].[OrderDetailStatusId], [dbo].[OrderDetail].[JobticketId], [dbo].[OrderDetail].[Jdf], [dbo].[OrderDetail].[Price], [dbo].[OrderDetail].[PrintstationId], [dbo].[OrderDetail].[PaperCopies], [dbo].[OrderDetail].[ProductID] AS [ProductId], [dbo].[OrderDetail].[Cancellled] FROM ((((( [dbo].[Order] INNER JOIN [dbo].[OrderDetail] ON [dbo].[Order].[OrderId]=[dbo].[OrderDetail].[OrderId]) LEFT JOIN [dbo].[Product] ON [dbo].[Product].[ProductId]=[dbo].[OrderDetail].[ProductID]) INNER JOIN [dbo].[OrderDetailStatus] ON [dbo].[OrderDetailStatus].[OrderDetailStatusId]=[dbo].[OrderDetail].[OrderDetailStatusId]) LEFT JOIN [dbo].[PriceQuote] ON [dbo].[OrderDetail].[OrderDetailId]=[dbo].[PriceQuote].[OrderDetailId]) INNER JOIN [dbo].[Portal] ON [dbo].[Portal].[PortalId]=[dbo].[Order].[PortalId]) WHERE ( ( ( [dbo].[OrderDetail].[PrintstationId] = @PrintstationId1 OR [dbo].[OrderDetail].[PrintstationId] IS NULL) AND ( ( [dbo].[Order].[ApprovalRequired] = @ApprovalRequired2) OR ( [dbo].[Order].[ApprovalRequired] = @ApprovalRequired3 AND [dbo].[Order].[Approved] = @Approved4)) AND ( ( [dbo].[Order].[AwaitingQuote] = @AwaitingQuote5 AND [dbo].[PriceQuote].[PriceQuoteId] IS NULL) OR ( [dbo].[Order].[AwaitingQuote] = @AwaitingQuote6 AND [dbo].[PriceQuote].[PriceQuoteId] IS NOT NULL AND [dbo].[PriceQuote].[Approved] = @Approved7)) AND [dbo].[OrderDetailStatus].[ShowPrintStation] = @ShowPrintStation8 AND ( [dbo].[Portal].[PortalId] = @PortalId9) AND [dbo].[Order].[PendingConfirmation] = @PendingConfirmation10)) Parameter: @PrintstationId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: c3b80755-3a0f-4906-b9f7-d0f3fc5f3e8c. Parameter: @ApprovalRequired2 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: False. Parameter: @ApprovalRequired3 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: True. Parameter: @Approved4 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: True. Parameter: @AwaitingQuote5 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: False. Parameter: @AwaitingQuote6 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: False. Parameter: @Approved7 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: True. Parameter: @ShowPrintStation8 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: True. Parameter: @PortalId9 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 73da12e8-0d79-42d6-8c19-b0ae0f0bc34a. Parameter: @PendingConfirmation10 : Boolean. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: False.

Method Exit: CreateSelectDQ Method Exit: CreatePagingSelectDQ: no paging. Method Enter: CreatePagingSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ Generated Sql query: Query: SELECT [dbo].[Document].[DocumentId], [dbo].[Document].[LibraryId], [dbo].[Document].[FileName], [dbo].[Document].[Description], [dbo].[Document].[FinalExtension], [dbo].[Document].[StatusId], [dbo].[Document].[CreatedDate], [dbo].[Document].[UpdateDate], [dbo].[Document].[MissingFonts], [dbo].[Document].[NumberOfPages], [dbo].[Document].[FileTypeId], [dbo].[Document].[LastOrderedDate], [dbo].[Document].[FileSize], [dbo].[Document].[ErrorMessage], [dbo].[Document].[UploadedBy], [dbo].[Document].[ProductId], [dbo].[Document].[ThumbnailsCreated] FROM [dbo].[Document] WHERE ( [dbo].[Document].[DocumentId] IN (@DocumentId1, @DocumentId2, @DocumentId3, @DocumentId4, @DocumentId5, @DocumentId6, @DocumentId7, @DocumentId8, @DocumentId9)) Parameter: @DocumentId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: c1c34f72-14b8-4464-b494-3d3ea005b668. Parameter: @DocumentId2 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: af169dd9-da64-4ee1-8598-076832fdbaf7. Parameter: @DocumentId3 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 67125d4d-6ef6-4521-9188-9fbded805766. Parameter: @DocumentId4 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: e3a72b61-9027-465f-9813-b68febfa1a5d. Parameter: @DocumentId5 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 19a92e82-3e3f-4407-bba0-89d5cd332c01. Parameter: @DocumentId6 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: ea243fe1-813f-45dc-acea-4fee812d8176. Parameter: @DocumentId7 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 053e5e65-8f66-4e1e-b62f-cbae616e2d4c. Parameter: @DocumentId8 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 8e30c189-06ef-423d-9b6a-23c432e0992d. Parameter: @DocumentId9 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 635e8199-6aad-43f5-b3bb-90a1bacd1df5.

Method Exit: CreateSelectDQ Method Exit: CreatePagingSelectDQ: no paging. Method Enter: CreatePagingSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ Generated Sql query: Query: SELECT [dbo].[Order].[OrderId], [dbo].[Order].[OrderDate], [dbo].[Order].[ShortOrderId], [dbo].[Order].[UserId], [dbo].[Order].[AccountCode], [dbo].[Order].[ApprovalRequired], [dbo].[Order].[Approved], [dbo].[Order].[ApprovedBy], [dbo].[Order].[ApprovedDate], [dbo].[Order].[PortalId], [dbo].[Order].[AwaitingQuote], [dbo].[Order].[Price], [dbo].[Order].[OrderComplete], [dbo].[Order].[CompletedDate], [dbo].[Order].[PendingConfirmation] FROM [dbo].[Order] WHERE ( [dbo].[Order].[OrderId] IN (@OrderId1, @OrderId2, @OrderId3, @OrderId4, @OrderId5, @OrderId6, @OrderId7, @OrderId8, @OrderId9, @OrderId10, @OrderId11, @OrderId12, @OrderId13, @OrderId14, @OrderId15, @OrderId16, @OrderId17, @OrderId18, @OrderId19)) Parameter: @OrderId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 877b53ae-1928-400f-ba32-ca3ee9be5882. Parameter: @OrderId2 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 76553e7a-522f-487b-bdaa-8bf47067422c. Parameter: @OrderId3 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 3af0e77a-1730-4022-9dfc-427a8990730d. Parameter: @OrderId4 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: be4218fa-bc9e-45bf-bc98-0509a361eb09. Parameter: @OrderId5 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 9d6187ad-f8d9-4fee-8612-368dca593cef. Parameter: @OrderId6 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: f7eb7955-5f96-46c1-98eb-c211df828e11. Parameter: @OrderId7 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 9a36569c-b3f2-4061-83ef-bee841d85b4c. Parameter: @OrderId8 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 8ae90cf6-491a-4800-9fc0-ae7b2e5a8524. Parameter: @OrderId9 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: e3150df2-5376-4457-8224-15e1d9e3259f. Parameter: @OrderId10 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 0204c47b-a651-4e71-9e70-cb6d32c25494. Parameter: @OrderId11 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 7e0373ec-76d3-4d32-865e-84bd3141393f. Parameter: @OrderId12 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 452e2aa1-50a1-40f9-8e9c-2d0b0e3cf8b1. Parameter: @OrderId13 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: d75a6952-b7b6-4696-8694-c74d8c85f197. Parameter: @OrderId14 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: c7457d35-4adc-4609-8cde-60770256a2c4. Parameter: @OrderId15 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: af410fbc-b1e8-425e-be98-7977fd35d7fc. Parameter: @OrderId16 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: c0a7bc22-e7bb-46c4-bc73-66b4401ce03c. Parameter: @OrderId17 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 8b1d02d5-a7fb-4624-a9ea-c5df6ea548d9. Parameter: @OrderId18 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: e0c6b501-a48f-414e-841c-956e79f81be8. Parameter: @OrderId19 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 32bfef06-5a4f-4ec7-9493-54bd608171ee.

Method Exit: CreateSelectDQ Method Exit: CreatePagingSelectDQ: no paging. Method Enter: CreatePagingSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ Generated Sql query: Query: SELECT [dbo].[User].[UserId], [dbo].[User].[ApplicationName], [dbo].[User].[UserName], [dbo].[User].[DeliveryXml], [dbo].[User].[DeliveryTemplateId] FROM [dbo].[User] WHERE ( [dbo].[User].[UserId] IN (@UserId1, @UserId2, @UserId3, @UserId4)) Parameter: @UserId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 595eeefc-da83-4eb5-a2d3-ae3ebd6b1ddd. Parameter: @UserId2 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 1955be1c-1ed6-4e08-aba4-a52524eab590. Parameter: @UserId3 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 60e61f51-b9af-4017-8910-805edf054627. Parameter: @UserId4 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 3d4daac2-a6bd-4d79-8988-9d7b85dc63af.

Method Exit: CreateSelectDQ Method Exit: CreatePagingSelectDQ: no paging. Method Enter: CreatePagingSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ Generated Sql query: Query: SELECT [dbo].[OrderDetailStatus].[OrderDetailStatusId], [dbo].[OrderDetailStatus].[PortalId], [dbo].[OrderDetailStatus].[StatusName], [dbo].[OrderDetailStatus].[ShowUser], [dbo].[OrderDetailStatus].[EndUserDisplay], [dbo].[OrderDetailStatus].[EmailUser], [dbo].[OrderDetailStatus].[AllowDelete], [dbo].[OrderDetailStatus].[ShowPrintStation], [dbo].[OrderDetailStatus].[InitialStatus], [dbo].[OrderDetailStatus].[AwaitingPaperOriginals], [dbo].[OrderDetailStatus].[QueryOutstanding], [dbo].[OrderDetailStatus].[InProduction], [dbo].[OrderDetailStatus].[Printed], [dbo].[OrderDetailStatus].[Deleted], [dbo].[OrderDetailStatus].[Archived], [dbo].[OrderDetailStatus].[Complete], [dbo].[OrderDetailStatus].[Downloaded], [dbo].[OrderDetailStatus].[SystemStatus], [dbo].[OrderDetailStatus].[StatusDeleted], [dbo].[OrderDetailStatus].[EmailContent], [dbo].[OrderDetailStatus].[EmailSubject] FROM [dbo].[OrderDetailStatus] WHERE ( [dbo].[OrderDetailStatus].[OrderDetailStatusId] IN (@OrderDetailStatusId1, @OrderDetailStatusId2, @OrderDetailStatusId3)) Parameter: @OrderDetailStatusId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 9755287a-a4b2-449c-b1a6-82ce2243bb90. Parameter: @OrderDetailStatusId2 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 9c38ca1f-6473-4be0-8c04-dd38bb4a0de3. Parameter: @OrderDetailStatusId3 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: ba3f40c0-daf3-44bb-a5c6-83155588a652.

Method Exit: CreateSelectDQ Method Exit: CreatePagingSelectDQ: no paging. Method Enter: CreatePagingSelectDQ Method Enter: CreateSelectDQ Method Enter: CreateSelectDQ Generated Sql query: Query: SELECT [dbo].[Product].[ProductId], [dbo].[Product].[Image], [dbo].[Product].[Name], [dbo].[Product].[Description], [dbo].[Product].[ProductXml], [dbo].[Product].[PortalId], [dbo].[Product].[Deleted], [dbo].[Product].[TemplateProduct], [dbo].[Product].[EquitracProduct] FROM [dbo].[Product] WHERE ( [dbo].[Product].[ProductId] IN (@ProductId1, @ProductId2, @ProductId3, @ProductId4)) Parameter: @ProductId1 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 2d43919c-a4f0-4180-b1f8-9b993bd4c852. Parameter: @ProductId2 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 29869197-2b41-4cdb-a1b7-e9815c31b7c8. Parameter: @ProductId3 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: 71a05ccd-0c29-46c4-9d14-6731fbf3c4d9. Parameter: @ProductId4 : Guid. Length: 0. Precision: 0. Scale: 0. Direction: Input. Value: bab8677e-c573-4b67-a806-7f508eb4af70.

Method Exit: CreateSelectDQ Method Exit: CreatePagingSelectDQ: no paging.

The document select is actually ignoring the column. disappointed

What on earth am I doing wrong?

Bex

BexMed
User
Posts: 63
Joined: 18-Jul-2007
# Posted on: 25-Feb-2010 10:52:28   

Ok flushed found out what it was.. Still odd behaviour but my fault...



   ExcludeIncludeFieldsList productExcludedFields = new ExcludeIncludeFieldsList();
            documentExcludedFields.Add(ProductFields.ProductXml);

these lines...!

Sorry!