在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
/// <summary>
/// 获取数据列表 /// </summary> /// <typeparam name="T">MODEL對象</typeparam> /// <param name="query">query對象</param> /// <param name="sortExpression">sortExpression</param> /// <param name="maximumRows">maximumRows</param> /// <param name="startRowIndex">startRowIndex</param> /// <returns></returns> public static IList<T> GetObjectList<T>(Query query, string sortExpression, int maximumRows, int startRowIndex) where T : Entity, new() { if (sortExpression == "") { sortExpression = "ID DESC"; } query.Page = Mindscape.LightSpeed.Querying.Page.At(startRowIndex, maximumRows); query.Order = Order.Parse(sortExpression); IList<Entity> listx = UnitOfWorkFactory.UnitOfWorkScope.Current.Find(query); IList<T> list = new List<T>(); foreach (Entity entity in listx) { list.Add((T)entity); } if (list.Count == 0) { list.Add(new T()); } return list; } |
请发表评论