Ejemplo n.º 1
0
        public void AddStrictly(T objSource)
        {
            string sKey = LineObjectCollection <T> .GetKeyName(objSource);

            ExcpHelper.ThrowIf(base.ContainsKey(sKey), "LineObjectCollection<{0}>.AddStrictly({1}) ERROR. Such object already exists in database.", m_type.Name, objSource);

            lock (m_oLocker)
            {
                base.Add(sKey, objSource);
            }
        }
Ejemplo n.º 2
0
        private void RemoveObjectsAfterCommit <T>(DelegateSetCacheItem <T> func) where T : ILineObject <T>
        {
            LineObjectCollection <T> loc = LineSr.Instance.ObjectsToRemove.GetLineObjectCollection <T>();

            if (loc != null)
            {
                foreach (T obj in loc.Values)
                {
                    func(obj);
                }
            }
        }
Ejemplo n.º 3
0
        private void UnsetPropertiesChanged <T>() where T : ILineObject <T>
        {
            Type type = typeof(T);

            if (this.ContainsKey(type))
            {
                LineObjectCollection <T> loc = this[type] as LineObjectCollection <T>;

                foreach (T obj in loc.Values)
                {
                    obj.UnsetPropertiesChanged();
                }
            }
        }
Ejemplo n.º 4
0
        public bool ContainsObjectByKey <T>(string sKey) where T : ILineObject <T>
        {
            Type type = typeof(T);
            LineObjectCollection <T> collection = null;

            lock (m_oLocker)
            {
                collection = m_di.ContainsKey(type) ? m_di[type] as LineObjectCollection <T> : null;
            }

            if (collection != null)
            {
                return(collection.ContainsKey(sKey));
            }

            return(false);
        }
Ejemplo n.º 5
0
        public void SafelyAddObject <T>(T obj) where T : ILineObject <T>
        {
            Type type = typeof(T);

            LineObjectCollection <T> collection = null;

            lock (m_oLocker)
            {
                if (m_di.ContainsKey(type))
                {
                    collection = m_di[type] as LineObjectCollection <T>;
                }
                else
                {
                    collection = new LineObjectCollection <T>();
                    m_di.Add(type, collection);
                }
            }

            Debug.Assert(collection != null);

            collection.AddSafely(obj);
        }