98 lines
2.4 KiB
C#
98 lines
2.4 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using System.Collections.Generic;
|
|
using System.Transactions;
|
|
using System;
|
|
using Church.Net.DAL.EF;
|
|
using System.Linq;
|
|
using Church.Net.Utility;
|
|
using System.Threading.Tasks;
|
|
using WebAPI.Logics.Interface;
|
|
using Church.Net.DAL.EFCoreDBF;
|
|
|
|
namespace WebAPI.Logics.Core
|
|
{
|
|
public class CombinedKeyLogicBase<T> : ICombinedKeyCrudLogic<T> where T : class, Church.Net.Entity.Interface.ICombinedKeyEntity, new()
|
|
{
|
|
private readonly LogicService logicService;
|
|
private readonly ICombinedKeyCrudDAL<T> crudDAL;
|
|
|
|
public CombinedKeyLogicBase(
|
|
LogicService logicService,
|
|
ICombinedKeyCrudDAL<T> crudDAL
|
|
)
|
|
{
|
|
this.logicService = logicService;
|
|
this.crudDAL = crudDAL;
|
|
}
|
|
|
|
public virtual bool CheckExist(T obj)
|
|
{
|
|
return this.crudDAL.CheckExist(obj);
|
|
}
|
|
|
|
public virtual int Create(T entity)
|
|
{
|
|
return this.crudDAL.Create(entity);
|
|
}
|
|
|
|
public virtual Task<int> CreateAsync(T entity)
|
|
{
|
|
return this.crudDAL.CreateAsync(entity);
|
|
}
|
|
|
|
public void CreateDone(T entity)
|
|
{
|
|
}
|
|
|
|
public int CreateOrUpdate(T entity)
|
|
{
|
|
var result= this.crudDAL.CreateOrUpdate(entity);
|
|
return result;
|
|
}
|
|
|
|
public int Delete(T obj)
|
|
{
|
|
return this.crudDAL.Delete(obj);
|
|
}
|
|
public int Delete(IEnumerable<string> combinedKeyIds)
|
|
{
|
|
return this.crudDAL.Delete(combinedKeyIds);
|
|
}
|
|
public int Delete(Func<T, bool> filter)
|
|
{
|
|
|
|
return this.crudDAL.Delete(filter);
|
|
}
|
|
|
|
public T First(Func<T, bool> filter = null)
|
|
{
|
|
return this.crudDAL.First(filter);
|
|
}
|
|
|
|
public IEnumerable<T> GetAll(Func<T, bool> filter = null)
|
|
{
|
|
return this.crudDAL.GetAll(filter);
|
|
}
|
|
|
|
|
|
public T GetById(IEnumerable<string> combinedKeyIds)
|
|
{
|
|
return this.crudDAL.GetById(combinedKeyIds);
|
|
}
|
|
|
|
public int Update(T entity)
|
|
{
|
|
return this.crudDAL.Update(entity);
|
|
}
|
|
|
|
public void UpdateDone(T entity)
|
|
{
|
|
}
|
|
|
|
public int UpdateRange(IEnumerable<T> entities)
|
|
{
|
|
return this.crudDAL.UpdateRange(entities);
|
|
}
|
|
}
|
|
}
|