Example #1
0
        void ReadAll()
        {
            PeopleStoreByName.MoveFirst();
            PeopleStoreByName.HintBatchCount = 103;
            long[] Pids      = new long[BatchCount];
            int    PidsIndex = 0;

            PersonKey[] pk  = new PersonKey[BatchCount];
            int         Ctr = 0;

            do
            {
                Ctr++;
                pk[PidsIndex++] = PeopleStoreByName.CurrentKey;
                if (PidsIndex == BatchCount)
                {
                    QueryResult <PersonKey>[] PeopleIDs;
                    if (PeopleStoreByName.Query(QueryExpression <PersonKey> .Package(pk), out PeopleIDs))
                    {
                        for (int i = 0; i < PeopleIDs.Length; i++)
                        {
                            Pids[i] = (long)PeopleIDs[i].Value;
                        }

                        QueryResult <long>[] PeopleFound;
                        if (PeopleStore.Query(QueryExpression <long> .Package(Pids), out PeopleFound))
                        {
                            long[] Aids = new long[PidsIndex];
                            int    i    = 0;
                            foreach (QueryResult <long> pf in PeopleFound)
                            {
                                if (pf.Found)
                                {
                                    Aids[i++] = ((Person)pf.Value).AddressID;
                                }
                            }
                            QueryResult <long>[] AddressesFound;
                            if (AddressStore.Query(QueryExpression <long> .Package(Aids), out AddressesFound))
                            {
                                //** process found Address records here...
                            }
                        }
                    }
                    PidsIndex = 0;
                }
            } while (PeopleStoreByName.MoveNext());
        }
Example #2
0
        void ReadAll()
        {
            PeopleStoreByName.MoveFirst();
            PeopleStoreByName.HintBatchCount = 103;
            long[] Pids      = new long[BatchCount];
            int    PidsIndex = 0;

            PersonKey[] pk  = new PersonKey[BatchCount];
            int         Ctr = 0;

            do
            {
                Ctr++;
                pk[PidsIndex++] = PeopleStoreByName.CurrentKey;
                if (PidsIndex == BatchCount)
                {
                    QueryResult <PersonKey>[] PeopleIDs;
                    if (PeopleStoreByName.Query(QueryExpression <PersonKey> .Package(pk), out PeopleIDs))
                    {
                        for (int i = 0; i < PeopleIDs.Length; i++)
                        {
                            Pids[i] = (long)PeopleIDs[i].Value;
                        }

                        QueryResult <long>[] PeopleFound;
                        if (PeopleStore.Query(QueryExpression <long> .Package(Pids), out PeopleFound))
                        {
                            long[] Aids = new long[PidsIndex];
                            int    i    = 0;
                            foreach (QueryResult <long> pf in PeopleFound)
                            {
                                if (pf.Found)
                                {
                                    Aids[i++] = ((Person)pf.Value).AddressID;
                                }
                            }
                            QueryResult <long>[] AddressesFound;
                            if (AddressStore.Query(QueryExpression <long> .Package(Aids), out AddressesFound))
                            {
                                //** process found Address records here...
                                int ctr2 = 0;
                                foreach (var a in AddressesFound)
                                {
                                    ctr2++;
                                    if (!a.Found)
                                    {
                                        Console.WriteLine("Failed to read {0}.", a.Key);
                                    }
                                }
                                if (ctr2 != 1000)
                                {
                                    Console.WriteLine("Failed to read 1000 records, 'only read {0}.", ctr2);
                                }
                            }
                        }
                    }
                    PidsIndex = 0;
                }
            } while (PeopleStoreByName.MoveNext());

            if (Ctr != PeopleStore.Count)
            {
                Console.WriteLine("Failed! Read {0}, expected {1}", Ctr * 4, PeopleStore.Count * 4);
            }
            else
            {
                Console.WriteLine("Read {0} items.", Ctr * 4);
            }
        }