2020-03-30 10:12:52 +08:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
|
|
|
|
|
namespace FAuth.Controllers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 控制器类基类
|
|
|
|
|
/// </summary>
|
2020-03-30 16:10:51 +08:00
|
|
|
|
public abstract class ControllerBase<LoggerType>:Controller
|
2020-03-30 10:12:52 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 日志记录服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
public ILogger Logger { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 服务集合
|
|
|
|
|
/// </summary>
|
|
|
|
|
public IServiceProvider Services { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 通过日志组件和服务集合生成控制器
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="logger">控制器日志组件</param>
|
|
|
|
|
/// <param name="service">服务集合</param>
|
2020-03-30 16:10:51 +08:00
|
|
|
|
public ControllerBase(ILogger<LoggerType> logger,IServiceProvider service) {
|
2020-03-30 10:12:52 +08:00
|
|
|
|
this.Logger = logger;
|
|
|
|
|
this.Services = service;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|