64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Linq.Expressions;
|
|
|
|
namespace HHWMS.Web
|
|
{
|
|
public interface IUnitWork
|
|
{
|
|
T FindSingle<T>(Expression<Func<T, bool>> where) where T : class;
|
|
|
|
T FindById<T>(Guid id) where T : class;
|
|
|
|
T FindById<T>(int id) where T : class;
|
|
|
|
IQueryable<T> Find<T>(Expression<Func<T, bool>> where) where T : class;
|
|
|
|
bool IsExit<T>(Expression<Func<T, bool>> where) where T : class;
|
|
|
|
int GetCount<T>(Expression<Func<T, bool>> where) where T : class;
|
|
|
|
int Add<T>(T entity) where T : class;
|
|
|
|
int BatchAdd<T>(T[] entities) where T : class;
|
|
|
|
/// <summary>
|
|
/// 添加到历史表,并将原数据删除
|
|
/// </summary>
|
|
/// <param name="name">历史表 表名</param>
|
|
/// <param name="where">条件</param>
|
|
/// <param name="entity">实体类</param>
|
|
/// <returns></returns>
|
|
int AddToHistory<T>(string name, Expression<Func<T, bool>> where, Expression<Func<T, object>> entity) where T : class;
|
|
|
|
int Update<T>(T entity) where T : class;
|
|
|
|
/// <summary>
|
|
/// 根据条件更新
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
/// <param name="where"></param>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
int BatchUpdate<T>(Expression<Func<T, bool>> where, Expression<Func<T, T>> entity) where T : class;
|
|
|
|
int Delete<T>(T entity) where T : class;
|
|
|
|
/// <summary>
|
|
/// 根据条件 批量删除
|
|
/// </summary>
|
|
/// <typeparam name="T"></typeparam>
|
|
/// <param name="where">条件</param>
|
|
/// <returns></returns>
|
|
int BatchDelete<T>(Expression<Func<T, bool>> where) where T : class;
|
|
|
|
int DeleteById<T>(T entity) where T : class;
|
|
|
|
int DeleteById<T>(int id) where T : class;
|
|
|
|
int BatchDelete<T>(T[] entities) where T : class;
|
|
|
|
string GetSerialNumber(string prefix, int length = 4);
|
|
}
|
|
}
|