Ejemplo n.º 1
0
        public void LicenseKeyTestCreate()
        {
            Sop.ObjectServer.LicenseKey = "TestKey";
            Sop.ObjectServer server = Sop.ObjectServer.OpenWithTransaction("c:\\SopBin\\OServer.dta");

            Sop.StoreFactory df = new Sop.StoreFactory();
            var sortDict        = df.Get <int, int>(server.SystemFile.Store, "Collection");

            sortDict.Add(1, 1);
            sortDict.Transaction.Commit();
        }
Ejemplo n.º 2
0
        public void IterationTest()
        {
            Sop.ObjectServer server = Sop.ObjectServer.OpenWithTransaction("c:\\SopBin\\OServer.dta");
            var       df            = new Sop.StoreFactory();
            const int ItemCount     = 50000;

            for (int i = 0; i < ItemCount; i++)
            {
                string s = string.Format("Collection{0}", i);
                using (var sortDict = df.Get <int, int>(server.SystemFile.Store, s))  //, null, false))
                {
                    sortDict.MoveFirst();
                    do
                    {
                        Console.WriteLine(string.Format("key = {0}, value = {1}", sortDict.CurrentKey, sortDict.CurrentValue));
                    } while (sortDict.MoveNext());
                }
            }
        }
Ejemplo n.º 3
0
        public void NullValueInStoreTest()
        {
            Sop.ObjectServer server = Sop.ObjectServer.OpenWithTransaction("c:\\SopBin\\OServer.dta");
            var df       = new Sop.StoreFactory();
            var sortDict = df.Get <int, FooBar>(server.SystemFile.Store, "Collection");

            if (sortDict.Count > 0)
            {
                do
                {
                    int    i   = sortDict.CurrentKey;
                    FooBar bar = sortDict.CurrentValue;
                } while (sortDict.MoveNext());
            }
            sortDict.Add(1, new FooBar()
            {
                Foo = "Hello World."
            });
            sortDict.Add(1, null);
            server.Commit();
        }
Ejemplo n.º 4
0
 public void TestSimpleWrite()
 {
     Sop.Log.Logger.DefaultLogDirectory = "\\\\MyBookLive\\Public\\SopBin2/";
     Sop.Log.Logger.Instance.LogLevel   = Sop.Log.LogLevels.Verbose;
     Console.WriteLine("Start");
     try
     {
         Sop.ObjectServer server = Sop.ObjectServer.OpenWithTransaction("\\\\MyBookLive\\Public\\SopBin2\\OServer.dta");
         var df       = new Sop.StoreFactory();
         var sortDict = df.Get <int, int>(server.SystemFile.Store, "Collection");
         for (int i = 0; i < 10000; i++)
         {
             sortDict.Add(i, i);
         }
         Sop.Log.Logger.Instance.Verbose("Record Count: {0}", sortDict.Count);
         server.Commit();
         Console.WriteLine("End");
     }
     catch (Exception exc)
     {
         Console.WriteLine("Error: {0}", exc.ToString());
         Sop.Log.Logger.Instance.Error(exc);
     }
 }