当前位置: 首页>>代码示例>>C#>>正文


C# IPersistent.GetType方法代码示例

本文整理汇总了C#中IPersistent.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IPersistent.GetType方法的具体用法?C# IPersistent.GetType怎么用?C# IPersistent.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IPersistent的用法示例。


在下文中一共展示了IPersistent.GetType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PersistThisModel

        /// <summary>
        /// Each subscriber can call this method to include any data it wishes to persist.  This data is intended to be user state metadata. It is not intended to be used for
        /// wholesale application database data.
        /// </summary>
        /// <param name="model">
        /// The model to persist.  The type of this model will be used as a key and when data is loaded back from persistent storage this key (type) will be used
        /// to retrieve it.  No other component should use this type, or collisions will occur.
        /// </param>
        /// <exception cref="System.Data.DuplicateNameException">Attempt to save application state with a model that has already been saved.</exception>
        public void PersistThisModel(IPersistent model)
        {
            if (this.modelsToPersist.Any(m => m.GetType() == model.GetType()))
            {
                throw new DuplicateNameException(
                    "Attempt to save application state with a model that has already been saved.");
            }

            this.modelsToPersist.Add(model);
        }
开发者ID:Benrnz,项目名称:ReesUserInteraction,代码行数:19,代码来源:ApplicationStateRequestedMessage.cs

示例2: LoadObject

 public virtual void LoadObject(IPersistent obj)
 {
     lock (this)
     {
         if (obj.IsRaw())
         {
             LoadStub(obj.Oid, obj, obj.GetType());
         }
     }
 }
开发者ID:kjk,项目名称:tenderbase,代码行数:10,代码来源:StorageImpl.cs

示例3: PackObject

 internal byte[] PackObject(IPersistent obj)
 {
     ByteBuffer buf = new ByteBuffer();
     int offs = ObjectHeader.Sizeof;
     buf.Extend(offs);
     ClassDescriptor desc = GetClassDescriptor(obj.GetType());
     if (obj is FastSerializable)
     {
         offs = ((FastSerializable) obj).Pack(buf, offs, encoding);
     }
     else
     {
         try
         {
             offs = PackObject(obj, desc, offs, buf, obj);
         }
         catch (System.Exception x)
         {
             throw new StorageError(StorageError.ACCESS_VIOLATION, x);
         }
     }
     ObjectHeader.SetSize(buf.arr, 0, offs);
     ObjectHeader.SetType(buf.arr, 0, desc.Oid);
     return buf.arr;
 }
开发者ID:kjk,项目名称:tenderbase,代码行数:25,代码来源:StorageImpl.cs

示例4: ToPersistentArray

 public virtual IPersistent[] ToPersistentArray(IPersistent[] arr)
 {
     if (arr.Length < nElems)
     {
         arr = (IPersistent[]) System.Array.CreateInstance(arr.GetType().GetElementType(), nElems);
     }
     if (root != null)
     {
         root.TraverseForward(height, arr, 0);
     }
     if (arr.Length > nElems)
     {
         arr[nElems] = null;
     }
     return arr;
 }
开发者ID:kjk,项目名称:tenderbase,代码行数:16,代码来源:AltBtree.cs

示例5: ToArray

 public virtual IPersistent[] ToArray(IPersistent[] arr)
 {
     if (arr.Length < used)
     {
         arr = (IPersistent[]) System.Array.CreateInstance(arr.GetType().GetElementType(), used);
     }
     for (int i = used; --i >= 0; )
     {
         arr[i] = LoadElem(i);
     }
     if (arr.Length > used)
     {
         arr[used] = null;
     }
     return arr;
 }
开发者ID:kjk,项目名称:tenderbase,代码行数:16,代码来源:LinkImpl.cs

示例6: ToPersistentArray

 /// <summary> Get all objects in the index as array ordered by index key.
 /// The runtime type of the returned array is that of the specified array.
 /// If the index fits in the specified array, it is returned therein.
 /// Otherwise, a new array is allocated with the runtime type of the
 /// specified array and the size of this index.<p>
 ///
 /// If this index fits in the specified array with room to spare
 /// (i.e., the array has more elements than this index), the element
 /// in the array immediately following the end of the index is set to
 /// <tt>null</tt>. This is useful in determining the length of this
 /// index <i>only</i> if the caller knows that this index does
 /// not contain any <tt>null</tt> elements.)<p>
 /// </summary>
 /// <returns> array of objects in the index ordered by key value
 /// </returns>
 public virtual IPersistent[] ToPersistentArray(IPersistent[] arr)
 {
     if (arr.Length < nMembers)
     {
         arr = (IPersistent[]) System.Array.CreateInstance(arr.GetType().GetElementType(), nMembers);
     }
     if (root != null)
     {
         root.ToArray(arr, 0);
     }
     if (arr.Length > nMembers)
     {
         arr[nMembers] = null;
     }
     return arr;
 }
开发者ID:kjk,项目名称:tenderbase,代码行数:31,代码来源:Ttree.cs


注:本文中的IPersistent.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。