2021-03-13 16:21:56 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Infrastructure;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using OpenAuth.App.Interface;
|
|
|
|
|
using OpenAuth.Repository.Core;
|
|
|
|
|
using OpenAuth.Repository.Domain;
|
|
|
|
|
using OpenAuth.Repository.Interface;
|
|
|
|
|
|
|
|
|
|
namespace OpenAuth.App
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ⭐⭐数据库Id为numberic类型的数据表相关业务使用该基类⭐⭐
|
|
|
|
|
/// 业务层基类,UnitWork用于事务操作,Repository用于普通的数据库操作
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
2021-03-13 23:45:10 +08:00
|
|
|
|
public class BaseLongApp<T, TDbContext> :BaseApp<T,TDbContext> where T : LongEntity where TDbContext: DbContext
|
2021-03-13 16:21:56 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
2021-03-13 23:45:10 +08:00
|
|
|
|
public BaseLongApp(IUnitWork<TDbContext> unitWork, IRepository<T,TDbContext> repository, IAuth auth) : base(unitWork, repository,auth)
|
2021-03-13 16:21:56 +08:00
|
|
|
|
{
|
|
|
|
|
}
|
2021-03-13 23:45:10 +08:00
|
|
|
|
|
2021-03-13 16:21:56 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 按id批量删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="ids"></param>
|
2021-03-13 23:45:10 +08:00
|
|
|
|
public void Delete(long[] ids)
|
2021-03-13 16:21:56 +08:00
|
|
|
|
{
|
|
|
|
|
Repository.Delete(u => ids.Contains(u.Id));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public T Get(long id)
|
|
|
|
|
{
|
|
|
|
|
return Repository.FirstOrDefault(u => u.Id == id);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-10-22 14:59:36 +08:00
|
|
|
|
}
|