コード例 #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));
        }
コード例 #2
0
ファイル: VwOleDbDaTests.cs プロジェクト: sillsdev/WorldPad
        public void TestUpdatePropIfCached()
        {
            // Create two test objects and add them to the language project.
            // It doesn't really matter what type of object they are as long
            // as the object contains at least one guid property.
            CmFilter testObj1 = new CmFilter();
            CmFilter testObj2 = new CmFilter();

            m_fdoCache.LangProject.FiltersOC.Add(testObj1);
            m_fdoCache.LangProject.FiltersOC.Add(testObj2);

            // Set a guid property for the 2nd test object
            // that is equal to the first test object's guid.
            m_sda.SetGuid(testObj2.Hvo, (int)CmFilter.CmFilterTags.kflidApp, testObj1.Guid);

            // This should not delete guid from the cache's internal object guid cache.
            m_da.UpdatePropIfCached(testObj2.Hvo, testObj2.FieldId,
                                    (int)CellarModuleDefns.kcptGuid, 0);

            // Make sure we still can create the first test object from it's guid.
            Assert.AreEqual(testObj1.Hvo, m_sda.get_ObjFromGuid(testObj1.Guid));
        }
コード例 #3
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Get the object ID (HVO) that corresponds to the specified GUID.
 /// </summary>
 /// <param name="guid"></param>
 /// <param name="sda"></param>
 /// <returns></returns>
 /// -----------------------------------------------------------------------------------
 public int GetIdFromGuid(ISilDataAccess sda, ref System.Guid guid)
 {
     return(sda.get_ObjFromGuid(guid));
 }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="uid"></param>
 /// <returns></returns>
 public int get_ObjFromGuid(Guid uid)
 {
     return(m_sda.get_ObjFromGuid(uid));
 }
コード例 #5
0
 /// -----------------------------------------------------------------------------------
 /// <summary>
 /// Get the object ID (HVO) that corresponds to the specified GUID.
 /// </summary>
 /// <param name="guid"></param>
 /// <param name="sda"></param>
 /// <returns></returns>
 /// -----------------------------------------------------------------------------------
 public int GetIdFromGuid(ISilDataAccess sda, ref System.Guid guid)
 {
     CheckDisposed();
     return(sda.get_ObjFromGuid(guid));
 }
コード例 #6
0
ファイル: VwBaseVc.cs プロジェクト: bbriggs/FieldWorks
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Get the object ID (HVO) that corresponds to the specified GUID.
		/// </summary>
		/// <param name="guid"></param>
		/// <param name="sda"></param>
		/// <returns></returns>
		/// -----------------------------------------------------------------------------------
		public int GetIdFromGuid(ISilDataAccess sda, ref System.Guid guid)
		{
			return sda.get_ObjFromGuid(guid);
		}
コード例 #7
0
ファイル: VwBaseVc.cs プロジェクト: sillsdev/WorldPad
		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Get the object ID (HVO) that corresponds to the specified GUID.
		/// </summary>
		/// <param name="guid"></param>
		/// <param name="sda"></param>
		/// <returns></returns>
		/// -----------------------------------------------------------------------------------
		public int GetIdFromGuid(ISilDataAccess sda, ref System.Guid guid)
		{
			CheckDisposed();
			return sda.get_ObjFromGuid(guid);
		}
コード例 #8
0
 /// <summary>
 /// Get the object that has the given guid.
 /// S_FALSE if no value is known for this property. Hvo will be 0.
 /// Some implementations may return S_OK and set <i>pHvo</i> to zero.
 ///</summary>
 /// <param name='uid'> </param>
 /// <returns></returns>
 public virtual int get_ObjFromGuid(Guid uid)
 {
     return(m_baseSda.get_ObjFromGuid(uid));
 }