发布网友 发布时间:2022-05-01 06:06
共3个回答
懂视网 时间:2022-05-01 10:27
引用如下:
public interface IThemePageService : IDynamicService<ThemePage> { }
就可以使用 上面的任何方法了
Resolve<IThemeConfigService>().GetList(r=>r.AppName=="User")
常见方法汇总
/// <summary> /// 获取列表 /// </summary> /// <param name="predicate">查询条件</param> /// <param name="sortOrder">排序方式</param> /// <returns></returns> IEnumerable<T> GetList(Expression<Func<T, bool>> predicate = null, Expression<Func<T, bool>> sortOrder = null); /// <summary> /// 查询单条记录 /// </summary> /// <param name="predicate">查询条件</param> /// <returns></returns> T GetSingle(Expression<Func<T, bool>> predicate); /// <summary> /// 删除系统 /// </summary> /// <param name="predicate">查询条件</param> ServiceResult Delete(Expression<Func<T, bool>> predicate); /// <summary> /// 查询分页 /// </summary> /// <param name="query"></param> /// <param name="predicate"></param> /// <returns></returns> PagedList<T> GetPagedList(QueryModel query, Expression<Func<T, bool>> predicate = null); /// <summary> /// 统计数量 /// </summary> /// <param name="predicate"></param> /// <returns></returns> long Count(Expression<Func<T, bool>> predicate); /// <summary> /// 添加单个实体 /// </summary> /// <param name="model"></param> /// <returns></returns> ServiceResult Add(T model); /// <summary> /// 更新单个实体 /// </summary> /// <param name="model"></param> /// <returns></returns> ServiceResult Update(T model); /// <summary> /// 批量添加多个实体 /// </summary> /// <param name="model"></param> /// <returns></returns> ServiceResult AddMany(IEnumerable<T> soucre); /// <summary> /// 批量更新多个实体 /// </summary> /// <param name="model"></param> /// <returns></returns> ServiceResult UpdateMany(Action<T> updateAction, Expression<Func<T, bool>> predicate=null);
一行代码添加GetList、GetSingle、Add、等数据库操作方法
标签:
热心网友 时间:2022-05-01 07:35
调用GetList方法如下:热心网友 时间:2022-05-01 08:53
GetList的返回值是DataSet 没有必要在定义一个Reports.Model.Tidbits了 直接把返回的DataSet 赋给dlSupplements就行 代码如下 private void Supplemen() { Reports.BLL.Tidbits ts = new Reports.BLL.Tidbits(); dlSupplements.DataSource = ts.GetList(6,"","DESC"); dlSupplements.DataBind(); }