Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I know about this post on BCS paging: Paging and sorting with BCS and have implemented a similar approach in a BCS solution. However, what I'm really looking for is a complete example showing how to use the batching and batching termination filter descriptors in a BCS .NET Connectivity solution. The MSDN post: http://msdn.microsoft.com/en-us/library/ee557835.aspx is incomplete. If anyone knows of a source (blog, article, book, chm, post-it note) that demonstrates exactly how to use these batching filter descriptors, please let me know where to find it.

Thanks!

share|improve this question

1 Answer 1

You can try this:

<Method Name="GetItems" LobName="GetItems" IsStatic="false">
          <FilterDescriptors>
            <FilterDescriptor Name="BatchingStateCookie" Type="Batching">
              <Properties>
                <Property Name="BatchingCookie" Type="System.String">Cookie</Property>
              </Properties>
            </FilterDescriptor>
            <FilterDescriptor Name="HasMoreBatches" Type="BatchingTermination">
              <Properties>
                <Property Name="CaseSensitive" Type="System.Boolean">false</Property>
                <Property Name="Comparator" Type="System.String">!=</Property>
                <Property Name="TerminationValue" Type="System.String">true</Property>
              </Properties>
            </FilterDescriptor>
          </FilterDescriptors>
          <Parameters>
            <Parameter Name="cookie" Direction="InOut">
              <TypeDescriptor Name="cookieTypeDescriptor" TypeName="System.String" AssociatedFilter="BatchingStateCookie"/>
            </Parameter>
            <Parameter Name="hasmore" Direction="Out">
              <TypeDescriptor Name="hasmoreTypeDescriptor" TypeName="System.String" AssociatedFilter="HasMoreBatches"/>
            </Parameter>

and in .NET:

int batch_size = 1000;
public MyItem[] GetItems(ref string cookie, out string hasmore)
{

    if (cookie == null) {
        // we are in first batch
        // do some initialization if needed
    }
    MyItem[] items = new MyItem[batch_size];
    ;
    hasmore =  GetItemsFromDatabase(cookie, items) > 0 ? "true" : "false";
    cookie = items[0].Id; // or something else you need to determine what to bring in the next batch
    return items;
}
share|improve this answer
    
Have you gotten this to work in BCS .NET Connectivity solution? I tried this code and the entity was no longer available when creating an external list. Inspecting the log revealed the following error message (Level: Medium - go figure!) "VLPROV: Finder 'ReadList' has a filter of type 'Batching'. These filters are not supported for external lists. Creating no view for this finder. ... ValidateDefaultFindSpecificWithFinderExistence failed for entity: Entity1" –  Tom Nov 16 '11 at 10:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.