예제 #1
0
 /// <summary>
 ///     从第三方客户数据转换为元数据
 ///     <para>* 此方法将会被轻量级的DataHelper所使用,并且写入的数据将不会拥有编号(Id)</para>
 /// </summary>
 /// <param name="proxy">内存片段代理器</param>
 /// <param name="target">目标对象实例</param>
 /// <param name="isArrayElement">当前写入的值是否为数组元素标示</param>
 /// <param name="isNullable">是否为可空字段标示</param>
 public unsafe override void Process(IMemorySegmentProxy proxy, object target, bool isArrayElement = false, bool isNullable = false)
 {
     TimeSpan[] array = (TimeSpan[])target;
     if (array == null || array.Length == 0)
     {
         return;
     }
     if (array.Length > 10)
         fixed(TimeSpan *pByte = array) proxy.WriteMemory(pByte, (uint)array.Length * Size.TimeSpan);
     else
     {
         for (int i = 0; i < array.Length; i++)
         {
             proxy.WriteTimeSpan(array[i]);
         }
     }
 }
        /// <summary>
        ///     从第三方客户数据转换为元数据
        ///     <para>* 此方法将会被轻量级的DataHelper所使用,并且写入的数据将不会拥有编号(Id)</para>
        /// </summary>
        /// <param name="proxy">内存片段代理器</param>
        /// <param name="target">目标对象实例</param>
        /// <param name="isArrayElement">当前写入的值是否为数组元素标示</param>
        /// <param name="isNullable">是否为可空字段标示</param>
        public override void Process(IMemorySegmentProxy proxy, object target, bool isArrayElement = false, bool isNullable = false)
        {
            TimeSpan value;

            if (!isNullable)
            {
                value = (TimeSpan)target;
            }
            else
            {
                if (target == null)
                {
                    return;
                }
                value = (TimeSpan)target;
            }
            proxy.WriteTimeSpan(value);
        }