Files
hrm_eva/EF/_IBaseRepository.cs
Nakorn Rientrakrunchai 8b98125e49 First Initial
2020-02-20 15:02:39 +07:00

42 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace TTSW.EF
{
public interface IBaseRepository<T, Key>
where T : class, IBaseEntity<Key>
{
#region Property
DbSet<T> Entities { get; }
DataContext Context { get; }
#endregion
#region Query Functions
T Get(Key id);
T Get(Key id, params Expression<Func<T, object>>[] includes);
IQueryable<T> GetQuery();
List<T> GetList(Expression<Func<T, bool>> predicate);
List<T> GetList(Expression<Func<T, bool>> predicate, params Expression<Func<T, object>>[] includes);
#endregion
#region Manipulation Functions
T Insert(T entity);
void Insert(IEnumerable<T> list);
T Update(Key id, object model);
T SetAsInActive(Key id);
T SetAsActive(Key id);
void Delete(Key id);
void Delete(Expression<Func<T, bool>> predicate);
void InsertWithoutCommit(T entity);
void UpdateWithoutCommit(Key id, object model);
void DeleteWithoutCommit(Key id);
#endregion
}
}