101 lines
3.2 KiB
C#
101 lines
3.2 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Threading.Tasks;
|
||
|
||
namespace SolarPower.Repository.Interface
|
||
{
|
||
public interface IRepositoryBase<T> where T : class
|
||
{
|
||
/// <summary>
|
||
/// 透過Id,取得單一資料
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
Task<T> GetOneAsync(int id);
|
||
|
||
/// <summary>
|
||
/// 取得所有資料
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
Task<List<T>> GetAllAsync();
|
||
|
||
/// <summary>
|
||
/// 新增資料
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <param name="properties"></param>
|
||
/// <returns></returns>
|
||
Task<int> AddAsync(T entity, List<string> properties);
|
||
|
||
/// <summary>
|
||
/// 新增單一筆資料
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <param name="properties"></param>
|
||
/// <returns></returns>
|
||
Task<int> AddOneAsync(T entity, List<string> properties);
|
||
|
||
/// <summary>
|
||
/// 修改資料
|
||
/// </summary>
|
||
/// <param name="entity"></param>
|
||
/// <param name="properties"></param>
|
||
/// <returns></returns>
|
||
Task Update(T entity, List<string> properties);
|
||
|
||
/// <summary>
|
||
/// 透過Id,軟刪除單一筆資料
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <returns></returns>
|
||
Task DeleteOne(int id);
|
||
|
||
/// <summary>
|
||
/// 透過Id,實際刪除單一筆資料
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
Task PurgeOneAsync(int id);
|
||
|
||
/// <summary>
|
||
/// 透過table_name、Id,軟刪除指定資料表的單一筆資料
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <param name="table_name"></param>
|
||
/// <returns></returns>
|
||
Task DeleteOneByIdWithCustomTable(int id, string table_name);
|
||
|
||
/// <summary>
|
||
/// 透過Id、db_name、table_name,刪除指定的資料庫之資料表的一筆資料
|
||
/// </summary>
|
||
/// <param name="id"></param>
|
||
/// <param name="db_name"></param>
|
||
/// <param name="table_name"></param>
|
||
/// <returns></returns>
|
||
Task DeleteOneByIdWithCustomDBNameAndTable(int id, string db_name, string table_name);
|
||
|
||
/// <summary>
|
||
/// 透過name list,取得指定的多筆設定變數
|
||
/// </summary>
|
||
/// <param name="names"></param>
|
||
/// <returns>回傳為字典格式</returns>
|
||
Task<Dictionary<string, string>> GetDictVariableByNames(List<string> names);
|
||
|
||
/// <summary>
|
||
/// 透過name,取得單一設定變數
|
||
/// </summary>
|
||
/// <param name="name"></param>
|
||
/// <returns></returns>
|
||
Task<string> GetOneVariableByName(string name);
|
||
|
||
/// <summary>
|
||
/// 取資料庫最後流水號
|
||
/// </summary>
|
||
/// <param name="Table_name"></param>
|
||
/// <param name="where"></param>
|
||
/// <returns></returns>
|
||
Task<String> GetCurrentSerialNumber(string Table_name, string where = "");
|
||
}
|
||
}
|