Initial commit

This commit is contained in:
Chris Chen
2022-09-08 08:04:32 -07:00
commit 184db15773
4604 changed files with 503905 additions and 0 deletions
@@ -0,0 +1,97 @@
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);
}
}
}
+102
View File
@@ -0,0 +1,102 @@
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 LogicBase<T> : ICrudLogic<T> where T : class, Church.Net.Entity.Interface.IEntity, new()
{
private readonly LogicService logicService;
private readonly ICrudDAL<T> crudDAL;
public LogicBase(
LogicService logicService,
ICrudDAL<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, out string id)
{
var result= this.crudDAL.CreateOrUpdate(entity, out string _id);
id = _id;
return result;
}
public string CreateReturnId(T entity)
{
return this.crudDAL.CreateReturnId(entity);
}
public int Delete(T obj)
{
return this.crudDAL.Delete(obj);
}
public int Delete(Func<T, bool> filter = null)
{
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 IEnumerable<T> GetAllById(IEnumerable<string> Ids)
{
return this.crudDAL.GetAllById(Ids);
}
public T GetById(string Id)
{
return this.crudDAL.GetById(Id);
}
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);
}
}
}
+16
View File
@@ -0,0 +1,16 @@
using Church.Net.DAL.EF;
namespace WebAPI.Logics.Core
{
public class LogicService
{
public LogicService(
ChurchNetContext dbContext
)
{
DbContext = dbContext;
}
public ChurchNetContext DbContext { get; }
}
}