Example #1
0
        public void TestCacheGuidProp_ForNonCmObjectGuid()
        {
            int  objFlid    = (int)CmObjectFields.kflidCmObject_Guid;
            int  nonObjFlid = 9005;            //CmFilterTags.kflidApp
            int  objHvo1    = 1124;
            int  objHvo2    = 1125;
            Guid guid       = Guid.NewGuid();

            // Cache the guids in this order. When this test failed, caching the
            // guid for the hvo objHvo2 clobbered the cached guid for object objHvo1
            // so there was no longer longer a guid in the cache for object objHvo1.
            m_IVwCacheDa.CacheGuidProp(objHvo1, objFlid, guid);
            m_IVwCacheDa.CacheGuidProp(objHvo2, nonObjFlid, guid);

            // Make sure the correct hvo is returned when
            // trying to create an object from the guid.
            Assert.AreEqual(objHvo1, m_ISilDataAccess.get_ObjFromGuid(guid));

            m_IVwCacheDa.ClearAllData();

            // Now cache the guids in the reverse order from the order done above.
            m_IVwCacheDa.CacheGuidProp(objHvo2, nonObjFlid, guid);
            m_IVwCacheDa.CacheGuidProp(objHvo1, objFlid, guid);

            // Make sure the same flid is returned when the caching is reversed.
            Assert.AreEqual(objHvo1, m_ISilDataAccess.get_ObjFromGuid(guid));
        }
Example #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                ShutDownTempWsFactory();                 // Must happen before call to base.
            }

            base.Dispose(disposing);

            if (disposing)
            {
                if (m_CacheDa != null)
                {
                    m_CacheDa.ClearAllData();
                }
            }

            m_vc         = null;
            m_DataAccess = null;
            m_wsf        = null;
            if (m_CacheDa != null && Marshal.IsComObject(m_CacheDa))
            {
                Marshal.ReleaseComObject(m_CacheDa);
            }
            m_CacheDa = null;
        }
Example #3
0
        /// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the bug.
        ///
        /// If subclasses override this method, they should call the base implementation.
        /// </remarks>
        protected override void Dispose(bool disposing)
        {
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            base.Dispose(disposing);

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_cd != null)
                {
                    m_cd.ClearAllData();
                    if (Marshal.IsComObject(m_cd))
                    {
                        Marshal.ReleaseComObject(m_cd);
                    }
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_svc = null;
            m_sda = null;
            m_cd  = null;
        }
Example #4
0
        /// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <param name="disposing"></param>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the bug.
        ///
        /// If subclasses override this method, they should call the base implementation.
        /// </remarks>
        protected override void Dispose(bool disposing)
        {
            //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            base.Dispose(disposing);

            if (disposing)
            {
                // Dispose managed resources here.
                if (m_svc != null)
                {
                    m_svc.Dispose();
                }
            }

            // Dispose unmanaged resources here, whether disposing is true or false.
            m_svc = null;
            m_sda = null;
            // LT-4779 - crashing due to m_cd being null already...
            if (m_cd != null)
            {
                m_cd.ClearAllData();
                if (Marshal.IsComObject(m_cd))
                {
                    Marshal.ReleaseComObject(m_cd);
                }
                m_cd = null;
            }
        }
Example #5
0
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
            // Must not be run more than once.
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
                if (m_view != null && !Controls.Contains(m_view))
                {
                    m_view.Dispose();
                }
                if (m_detailView != null && !Controls.Contains(m_detailView))
                {
                    m_detailView.Dispose();
                }
            }
            m_sel        = null;
            m_cache      = null;
            m_view       = null;
            m_detailView = null;
            if (m_cdaTemp != null)
            {
                m_cdaTemp.ClearAllData();
                Marshal.ReleaseComObject(m_cdaTemp);
                m_cdaTemp = null;
            }

            base.Dispose(disposing);
        }