using System;
using Falcon.Extend;
using FAuth.DataBase;
using FAuth.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace FAuth.Controllers
{
///
/// 控制器类基类
///
//[Route("[Controller]/[Action]")]
public abstract class ControllerBase:Controller
{
///
/// 日志记录服务
///
public ILogger Logger { get; set; }
///
/// 服务集合
///
public IServiceProvider Services { get; set; }
///
/// 数据库
///
public FAuthDb Db { get; set; }
///
/// 数据缓冲
///
public ICacheProvider Cache { get; set; }
///
/// Cookie中定义的键
///
public CookieKeyDefine CookieKeys { get; set; }
///
/// 通过日志组件和服务集合生成控制器
///
/// 控制器日志组件
/// 服务集合
public ControllerBase(ILogger logger,IServiceProvider service) {
this.Logger = logger;
this.Services = service;
this.Db = service.GetService();
this.Cache = service.GetService();
this.CookieKeys = Services.GetService>().Value;
}
}
}