FIC_Solar/SolarPower/Repository/Interface/IRepositoryBase.cs
2021-06-23 11:04:09 +08:00

101 lines
3.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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);
}
}