You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Configuration;
|
|
using System.Threading;
|
|
using SiaSun.LMS.Model;
|
|
|
|
namespace SiaSun.LMS.Common
|
|
|
|
{
|
|
public static class ModelConverter
|
|
{
|
|
|
|
/// <summary>
|
|
/// 返回实体集类型
|
|
/// </summary>
|
|
/// <typeparam name="T">实体类型</typeparam>
|
|
/// <param name="objectTList">服务端返回的ObjectTList</param>
|
|
/// <returns>实体集</returns>
|
|
public static List<T> ToList<T>(this ObjectList objectTList)
|
|
{
|
|
List<T> result = new List<T>();
|
|
IList<object> list = objectTList.RequestObject;
|
|
foreach (object obj in list)
|
|
{
|
|
result.Add((T)obj);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 返回实体类型
|
|
/// </summary>
|
|
/// <typeparam name="T">实体类型</typeparam>
|
|
/// <param name="objectT">服务端返回的ObjectT</param>
|
|
/// <returns>实体</returns>
|
|
public static T ToModel<T>(this ObjectT objectT)
|
|
{
|
|
return (T)objectT.RequestObject;
|
|
}
|
|
|
|
}
|
|
}
|