예제 #1
0
        static int Compare(SoodaObject o1, SoodaObject o2)
        {
            int retval = string.CompareOrdinal(o1.GetClassInfo().Name, o2.GetClassInfo().Name);
            if (retval != 0)
                return retval;

            return ((IComparable) o1.GetPrimaryKeyValue()).CompareTo(o2.GetPrimaryKeyValue());
        }
예제 #2
0
 internal void MarkPrecommitted(SoodaObject o)
 {
     _precommittedClassOrRelation[o.GetClassInfo().GetRootClass().Name] = true;
 }
예제 #3
0
        protected internal void UnregisterObject(SoodaObject o)
        {
            object pkValue = o.GetPrimaryKeyValue();

            if (ExistsObjectWithKey(o.GetClassInfo().Name, pkValue))
            {
                UnregisterObjectWithKey(o.GetClassInfo().Name, pkValue);
                for (ClassInfo ci = o.GetClassInfo().InheritsFromClass; ci != null; ci = ci.InheritsFromClass)
                {
                    UnregisterObjectWithKey(ci.Name, pkValue);
                }
                RemoveWeakSoodaObjectFromCollection(_objectList, o);

                List<WeakSoodaObject> al;
                if (_objectsByClass.TryGetValue(o.GetClassInfo().Name, out al))
                {
                    RemoveWeakSoodaObjectFromCollection(al, o);
                }
            }
        }
예제 #4
0
        protected internal bool IsRegistered(SoodaObject o)
        {
            object pkValue = o.GetPrimaryKeyValue();

            return ExistsObjectWithKey(o.GetClassInfo().Name, pkValue);
        }
예제 #5
0
 protected internal void RegisterDirtyObject(SoodaObject o)
 {
     // transactionLogger.Debug("RegisterDirtyObject({0})", o.GetObjectKeyString());
     _dirtyObjects.Add(o);
     for (ClassInfo ci = o.GetClassInfo(); ci != null; ci = ci.InheritsFromClass)
     {
         List<WeakSoodaObject> al;
         if (!_dirtyObjectsByClass.TryGetValue(ci.Name, out al))
         {
             al = new List<WeakSoodaObject>();
             _dirtyObjectsByClass[ci.Name] = al;
         }
         al.Add(new WeakSoodaObject(o));
     }
 }
예제 #6
0
        protected internal void RegisterObject(SoodaObject o)
        {
            // Console.WriteLine("Registering object {0}...", o.GetObjectKey());

            object pkValue = o.GetPrimaryKeyValue();
            // Console.WriteLine("Adding key: " + o.GetObjectKey() + " of type " + o.GetType());
            for (ClassInfo ci = o.GetClassInfo(); ci != null; ci = ci.InheritsFromClass)
            {
                AddObjectWithKey(ci.Name, pkValue, o);

                List<WeakSoodaObject> al;
                if (!_objectsByClass.TryGetValue(ci.Name, out al))
                {
                    al = new List<WeakSoodaObject>();
                    _objectsByClass[ci.Name] = al;
                }
                al.Add(new WeakSoodaObject(o));
            }

            if (!UseWeakReferences)
                _strongReferences.Add(o);

            _objectList.Add(new WeakSoodaObject(o));

            if (_precommitQueue != null)
                _precommitQueue.Enqueue(o);

        }