OpenAuth.Net/OpenAuth.App/Base/BaseStringApp.cs
yubaolee 9fd0405721 同步openauth.Core:
采用代码生成器的表结构控制前端显示,删除以前按照dbset获取数据库结构
优化注释
升级EF及所有三方的版本
2021-10-18 00:42:29 +08:00

40 lines
1.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.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>
/// 业务层基类UnitWork用于事务操作Repository用于普通的数据库操作
/// <para>如用户管理Class UserManagerApp:BaseApp&lt;User&gt;</para>
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="TDbContext"></typeparam>
public class BaseStringApp<T, TDbContext> :BaseApp<T,TDbContext> where T : StringEntity where TDbContext: DbContext
{
public BaseStringApp(IUnitWork<TDbContext> unitWork, IRepository<T,TDbContext> repository, IAuth auth) : base(unitWork, repository, auth)
{
}
/// <summary>
/// 按id批量删除
/// </summary>
/// <param name="ids"></param>
public virtual void Delete(string[] ids)
{
Repository.Delete(u => ids.Contains(u.Id));
}
public T Get(string id)
{
return Repository.FirstOrDefault(u => u.Id == id);
}
}
}