示例#1
0
        private static void Deactivate()
        {
            using (IObjectContainer container = Db4oEmbedded.OpenFile("database.db4o"))
            {
                var jodie = QueryForJodie(container);

                container.Activate(jodie, 5);

                // #example: Deactivate an object
                Console.WriteLine(jodie.Name);
                // Now all fields will be null or 0
                // The same applies for all references objects up to a depth of 5
                container.Deactivate(jodie, 5);
                Console.WriteLine(jodie.Name);
                // #end example
            }
        }
示例#2
0
 public PlayerEntry GetPlayer(Int64 id)
 {
     lock (_lobbycache)
     {
         var ply = _lobbycache.Find(p => p.Id == id);
         if (ply != null)
         {
             return(ply);
         }
     }
     lock (DatabaseLock)
     {
         var ret = Database.Query <PlayerEntry>().FirstOrDefault(e => e.Id == id);
         if (ret == null)
         {
             return(null);
         }
         ret = ret.CloneT();
         Database.Deactivate(ret, int.MaxValue);
         return(ret);
     }
 }
示例#3
0
 public void Deactivate(object obj, int depth)
 {
     session.Deactivate(obj, depth);
 }
示例#4
0
 /// <summary>
 /// Deactivates the specified obj.
 /// </summary>
 /// <param name="obj">The obj.</param>
 /// <param name="depth">The depth.</param>
 public void Deactivate(object obj, int depth)
 {
     container.Deactivate(obj, depth);
 }
示例#5
0
 public void PerformUpdate(IObjectContainer db)
 {
     db.Deactivate(objectToDeactivate, deactivateDepth);
 }