当前位置: 首页>>代码示例>>C#>>正文


C# SessionNoServer.Verify方法代码示例

本文整理汇总了C#中SessionNoServer.Verify方法的典型用法代码示例。如果您正苦于以下问题:C# SessionNoServer.Verify方法的具体用法?C# SessionNoServer.Verify怎么用?C# SessionNoServer.Verify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SessionNoServer的用法示例。


在下文中一共展示了SessionNoServer.Verify方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Verify

 public void Verify(string dir)
 {
   using (SessionNoServer session = new SessionNoServer(dir))
   {
     session.BeginRead();
     session.Verify();
     session.Commit();
   }
 }
开发者ID:MerlinBrasil,项目名称:VelocityDB,代码行数:9,代码来源:SchemaTests.cs

示例2: CreateDataAndIterateDb

    public void CreateDataAndIterateDb(int numObj)
    {
      using (SessionNoServer session = new SessionNoServer(systemDir))
      {
        session.Verify();
        session.BeginUpdate();
        UInt32 dbNum = session.DatabaseNumberOf(typeof(NotSharingPage));
        Database db = session.OpenDatabase(dbNum, true, false);
        if (db != null)
          session.DeleteDatabase(db);
        dbNum = session.DatabaseNumberOf(typeof(SharingPageTypeA));
        db = session.OpenDatabase(dbNum, true, false);
        if (db != null)
          session.DeleteDatabase(db);
        dbNum = session.DatabaseNumberOf(typeof(SharingPageTypeB));
        db = session.OpenDatabase(dbNum, true, false);
        if (db != null)
          session.DeleteDatabase(db);
        session.Commit();
      }

      using (SessionNoServer session = new SessionNoServer(systemDir))
      {
        session.Verify();
        session.BeginUpdate();
        UInt32 dbNum = session.DatabaseNumberOf(typeof(SharingPageTypeB));
        Placement place = new Placement(dbNum, 100);
        for (int i = 0; i < numObj; i++)
        {
          NotSharingPage ns = new NotSharingPage();
          session.Persist(ns);
          SharingPageTypeA sA = new SharingPageTypeA();
          session.Persist(sA);
          SharingPageTypeB sB = new SharingPageTypeB();
          if (i % 5 == 0)
            sB.Persist(session, place);
          else if (i % 1001 == 0)
            sB.Persist(session, sA);
          else if (i % 3001 == 0)
            sB.Persist(session, ns);
          else
            session.Persist(sB);
        }
        session.Commit();
      }

      using (SessionNoServer session = new SessionNoServer(systemDir))
      {
        session.BeginRead();
        session.Verify();
        UInt32 dbNum = session.DatabaseNumberOf(typeof(NotSharingPage));
        Database db = session.OpenDatabase(dbNum);
        AllObjects<NotSharingPage> all = db.AllObjects<NotSharingPage>();
        ulong ct = all.Count();
        dbNum = session.DatabaseNumberOf(typeof(SharingPageTypeA));
        OfType ofType = db.OfType(typeof(NotSharingPage));
        ulong ct2 = ofType.Count();
        Assert.AreEqual(ct, ct2);
        Database dbA = session.OpenDatabase(dbNum);
        dbNum = session.DatabaseNumberOf(typeof(SharingPageTypeB));
        Database dbB = session.OpenDatabase(dbNum);
        AllObjects<SharingPageTypeA> allA = dbA.AllObjects<SharingPageTypeA>();
        AllObjects<SharingPageTypeB> allB = dbB.AllObjects<SharingPageTypeB>();
        OfType allA2 = dbA.OfType(typeof(SharingPageTypeA));
        int start = numObj / 2;
        NotSharingPage ns = all.ElementAt(numObj);
        SharingPageTypeA sA = allA.ElementAt(numObj);
        SharingPageTypeA sA2 = (SharingPageTypeA)allA2.ElementAt(numObj);
        Assert.AreEqual(sA, sA2);
        sA = allA.ElementAt(10);
        sA2 = (SharingPageTypeA)allA2.ElementAt(10);
        Assert.AreEqual(sA, sA2);
        //MethodInfo method = typeof(Database).GetMethod("AllObjects");
        //MethodInfo generic = method.MakeGenericMethod(sA.GetType());
        //dynamic itr = generic.Invoke(dbA, new object[]{ true });
        //SharingPageTypeA sAb = itr.ElementAt(numObj);
        //Assert.AreEqual(sA, sAb);
        //SharingPageTypeA sAc = itr.ElementAt(numObj);
        SharingPageTypeB sB = allB.ElementAt(numObj);
        List<NotSharingPage> notSharingPageList = all.Skip(100).ToList();
        List<SharingPageTypeA> sharingPageTypeA = allA.Take(5).Skip(100).ToList();
        for (int i = start; i < numObj; i++)
          sA = allA.ElementAt(i);
        for (int i = start; i < numObj; i += 5)
          ns = all.ElementAt(i);
        for (int i = start; i < numObj; i += 5)
          sB = allB.ElementAt(i);
        for (int i = 0; i < numObj; i += 45000)
          ns = all.ElementAt(i);
        int allB_count = (int) allB.Count();
        for (int i = 0; i < allB_count - 1; i++)
        {
          Assert.NotNull(allB.ElementAt(i));
        }
        session.Commit();
        session.BeginUpdate();
        session.DeleteDatabase(db);
        session.DeleteDatabase(dbA);
        session.DeleteDatabase(dbB);
        session.Commit();
//.........这里部分代码省略.........
开发者ID:VelocityDB,项目名称:VelocityDB,代码行数:101,代码来源:ADatabaseIteration.cs

示例3: DO

    [Repeat(3)] // remove when propagation of optimistic locking flag is done to slave database locations TO DO (issue caused by CopyAllDatabasdesTo that uses pessimistic locking)
    public void multipleServersOK()
    {
      using (SessionNoServer session = new SessionNoServer(systemDir))
      {
        session.BeginRead();
        foreach (DatabaseLocation loc in session.DatabaseLocations)
          Console.WriteLine(loc.ToStringDetails(session, false));
        session.Commit();
      }

      using (ServerClientSession session = new ServerClientSession(systemDir, systemHost))
      {
        session.SetTraceDbActivity(0);
        DatabaseLocation localLocation = new DatabaseLocation(systemHost, location2Dir, 10000, 20000, session, PageInfo.compressionKind.LZ4, 0);
        Placement place = new Placement(10000, 2);
        session.BeginUpdate();
        foreach (DatabaseLocation loc in session.DatabaseLocations)
          Console.WriteLine(loc.ToStringDetails(session, false));
        Console.WriteLine();
        session.NewLocation(localLocation);
        foreach (DatabaseLocation loc in session.DatabaseLocations)
          Console.WriteLine(loc.ToStringDetails(session, false));
        Man aMan = null;
        Woman aWoman = null;

        for (int j = 1; j <= 5; j++)
        {
          aMan = new Man(null, aMan, DateTime.UtcNow);
          aMan.Persist(place, session);
          aWoman = new Woman(aMan, aWoman);
          aWoman.Persist(place, session);
          aMan.m_spouse = new WeakIOptimizedPersistableReference<VelocityDbSchema.Person>(aWoman);
          if (j % 1000 == 0)
          {
            session.FlushUpdates();
          }
        }
        localLocation = new DatabaseLocation(systemHost2, systemDir, 20001, 30000, session, PageInfo.compressionKind.LZ4, 0);
        session.NewLocation(localLocation);
        foreach (DatabaseLocation loc in session.DatabaseLocations)
          Console.WriteLine(loc.ToStringDetails(session, false));
        place = new Placement(20001);
        //localDatabase = session.NewDatabase(20001, localLocation);
        for (int j = 1; j <= 5; j++)
        {
          aMan = new Man(null, aMan, DateTime.UtcNow);
          aMan.Persist(place, session);
          aWoman = new Woman(aMan, aWoman);
          aWoman.Persist(place, session);
          aMan.m_spouse = new WeakIOptimizedPersistableReference<VelocityDbSchema.Person>(aWoman);
          if (j % 1000 == 0)
          {
            session.FlushUpdates();
          }
        }
        DatabaseLocation serverLocation = new DatabaseLocation(systemHost2, location2Dir, 30001, 40000, session, PageInfo.compressionKind.LZ4, 0);
        session.NewLocation(serverLocation);
        foreach (DatabaseLocation loc in session.DatabaseLocations)
          Console.WriteLine(loc.ToStringDetails(session, false));
        place = new Placement(30001);
        for (int j = 1; j <= 5; j++)
        {
          aMan = new Man(null, aMan, DateTime.UtcNow);
          aMan.Persist(place, session);
          aWoman = new Woman(aMan, aWoman);
          aWoman.Persist(place, session);
          aMan.m_spouse = new WeakIOptimizedPersistableReference<VelocityDbSchema.Person>(aWoman);
          if (j % 1000 == 0)
          {
            session.FlushUpdates();
          }
        }
        localLocation = new DatabaseLocation(systemHost3, systemDir, 40001, 50000, session, PageInfo.compressionKind.None, 0);
        session.NewLocation(localLocation);
        place = new Placement(40001);
        //localDatabase = session.NewDatabase(20001, localLocation);
        for (int j = 1; j <= 5; j++)
        {
          aMan = new Man(null, aMan, DateTime.UtcNow);
          aMan.Persist(place, session);
          aWoman = new Woman(aMan, aWoman);
          aWoman.Persist(place, session);
          aMan.m_spouse = new WeakIOptimizedPersistableReference<VelocityDbSchema.Person>(aWoman);
          if (j % 1000 == 0)
          {
            session.FlushUpdates();
          }
        }
        session.Commit();
      }

      using (ServerClientSession session = new ServerClientSession(systemDir, systemHost))
      {
        session.CopyAllDatabasesTo(copyDir);
        using (SessionNoServer copySession = new SessionNoServer(copyDir))
        {
          copySession.Verify();
        }
      }
//.........这里部分代码省略.........
开发者ID:VelocityDB,项目名称:VelocityDB,代码行数:101,代码来源:MultipleServers.cs


注:本文中的SessionNoServer.Verify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。