Exemplo n.º 1
0
        public void CreateCompareFields(int numberOfLoops, int comparisonByteArraySize)
        {
            GCLatencyMode gcLatencyMode = GCSettings.LatencyMode;

            Person.s_randGen = new Random(5);
            try
            {
                using (SessionNoServer session = new SessionNoServer(systemDir))
                {
                    //session.ClientCache.MinimumAvailableMegaBytes = 1100;
                    //session.SetTraceAllDbActivity();
                    Man   aMan;
                    Woman aWoman;
                    session.BeginUpdate();
                    CompareByField <Person> compareByField = new CompareByField <Person>("m_firstName", session, false);
                    compareByField.AddFieldToCompare("m_lastName");
                    compareByField.AddFieldToCompare("m_age");
                    BTreeSet <Person> bTree = new BTreeSet <Person>(compareByField, session, 2000, (ushort)comparisonByteArraySize);
                    Placement         place = new Placement((UInt32)numberOfLoops);
                    bTree.Persist(place, session);
                    for (int i = 0; i < numberOfLoops; i++)
                    {
                        aMan   = new Man();
                        aWoman = new Woman();
                        bTree.AddFast(aMan);
                        bTree.AddFast(aWoman);
                        if (i % 5000 == 0)
                        {
                            bTree.FlushTransients();
                        }
                    }
                    session.Commit();
                }
            }
            finally
            {
                GCSettings.LatencyMode = gcLatencyMode;
            }
        }
Exemplo n.º 2
0
 public void CreateCompareFields(int numberOfLoops, int comparisonByteArraySize)
 {
   GCLatencyMode gcLatencyMode = GCSettings.LatencyMode; 
   Person.s_randGen = new Random(5);
   try
   {
     using (SessionNoServer session = new SessionNoServer(systemDir))
     {
       //session.ClientCache.MinimumAvailableMegaBytes = 1100;
       //session.SetTraceAllDbActivity();
       Man aMan;
       Woman aWoman;
       session.BeginUpdate();
       CompareByField<Person> compareByField = new CompareByField<Person>("m_firstName", session, false);
       compareByField.AddFieldToCompare("m_lastName");
       compareByField.AddFieldToCompare("m_age");
       BTreeSet<Person> bTree = new BTreeSet<Person>(compareByField, session, 2000, (ushort)comparisonByteArraySize);
       Placement place = new Placement((UInt32)numberOfLoops);
       bTree.Persist(place, session);
       for (int i = 0; i < numberOfLoops; i++)
       {
         aMan = new Man();
         aWoman = new Woman();
         bTree.AddFast(aMan);
         bTree.AddFast(aWoman);
         if (i % 5000 == 0)
           bTree.FlushTransients();    
       }
       session.Commit();
     }
   }
   finally
   {
     GCSettings.LatencyMode = gcLatencyMode;
   }
 }