示例#1
0
 public HomeController(ILogger <HomeController> logger,
                       IMemoryCache memoryCache,
                       IDefaultRepository defaultRepository,
                       IKardSession kardSession) : base(logger, memoryCache, kardSession)
 {
     _defaultRepository = defaultRepository;
 }
        ///// <summary>
        ///// Creates a new instance of the ApiAuthorizedMiddleware.
        ///// </summary>
        ///// <param name="next">The next middleware in the pipeline.</param>
        ///// <param name="hostingEnv">The <see cref="IHostingEnvironment"/> used by this middleware.</param>
        ///// <param name="options">The configuration options.</param>
        ///// <param name="loggerFactory">An <see cref="ILoggerFactory"/> instance used to create loggers.</param>
        public ApiAuthorizationMiddleware(RequestDelegate next, IHostingEnvironment hostingEnv, IOptions <ApiAuthorizationOptions> options, ILoggerFactory loggerFactory, IKardSession session)
        {
            if (next == null)
            {
                throw new ArgumentNullException(nameof(next));
            }

            if (hostingEnv == null)
            {
                throw new ArgumentNullException(nameof(hostingEnv));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (loggerFactory == null)
            {
                throw new ArgumentNullException(nameof(loggerFactory));
            }

            _next    = next;
            _options = options.Value;
            _logger  = loggerFactory.CreateLogger <ApiAuthorizationMiddleware>();
            _session = session;
        }
示例#3
0
        public LoginAppService(
            IServiceProvider serviceProvider,
            IKardSession kardSession,
            IConfiguration configuration,
            IPasswordHasher <KuserEntity> passwordHasher,
            IRepositoryFactory repositoryFactory)
        {
            _kardSession       = kardSession;
            _passwordHasher    = passwordHasher;
            _configuration     = configuration;
            _repositoryFactory = repositoryFactory;
            _defaultRepository = repositoryFactory.GetRepository <IDefaultRepository>();
            _kuserRepository   = repositoryFactory.GetRepository <IKuserRepository>();

            //测试
            //scope.Dispose()-->childProvider.Dispose()删除对Service实例的引用
            using (var scope = serviceProvider.GetService <IServiceScopeFactory>().CreateScope())
            {
                var childProvider = scope.ServiceProvider;

                var    r1     = serviceProvider.GetService <IKuserRepository>();
                var    r2     = childProvider.GetService <IKuserRepository>();
                bool   result = (r1.GetHashCode().Equals(r2.GetHashCode()));
                string ee     = result.ToString();
            }
        }
示例#4
0
 public HomeController(
     IMemoryCache memoryCache,
     IRepositoryFactory repositoryFactory,
     IKardSession kardSession) : base(memoryCache, kardSession)
 {
     _repositoryFactory = repositoryFactory;
 }
示例#5
0
 public WxController(
     ILogger <WxController> logger,
     IMemoryCache memoryCache,
     ILoginAppService loginAppService,
     IKardSession kardSession,
     IDefaultRepository defaultRepository) : base(logger, memoryCache, kardSession)
 {
     _loginAppService   = loginAppService;
     _defaultRepository = defaultRepository;
 }
示例#6
0
 public WebUserController(
     ILogger <WebUserController> logger,
     IMemoryCache memoryCache,
     ILoginAppService loginAppService,
     IKardSession kardSession)
     : base(logger, memoryCache, kardSession)
 {
     //HttpContext.Session.SetString("UserId", user.Id.ToString());
     _loginAppService = loginAppService;
 }
示例#7
0
 public UserController(IHostingEnvironment env,
                       ILogger <UserController> logger,
                       IMemoryCache memoryCache,
                       IDefaultRepository defaultRepository,
                       IKardSession kardSession)
     : base(logger, memoryCache, kardSession)
 {
     //HttpContext.Session.SetString("UserId", user.Id.ToString());
     _env = env;
     _defaultRepository = defaultRepository;
 }
示例#8
0
 public EssayController(IHostingEnvironment env,
                        ILogger <EssayController> logger,
                        IMemoryCache memoryCache,
                        IDefaultRepository defaultRepository,
                        IKardSession kardSession,
                        IConfiguration configuration) : base(logger, memoryCache, kardSession)
 {
     _env = env;
     _defaultRepository = defaultRepository;
     _configuration     = configuration;
 }
示例#9
0
        public CommonController(IHostingEnvironment env,
                                IMemoryCache memoryCache,
                                IBaiduspiderAppService baiduspiderAppService,

                                IKardSession kardSession,
                                IConfiguration configuration) : base(memoryCache, kardSession)
        {
            _env = env;
            _baiduspiderAppService = baiduspiderAppService;
            _configuration         = configuration;
        }
示例#10
0
        //public LoginAppService(
        //    UserManager<KuserEntity> userManager,
        //    IKardSession kardSession,
        //    IPasswordHasher<KuserEntity> passwordHasher,
        //    IPasswordValidator<KuserEntity> passwordValidator,
        //    IDefaultRepository defaultRepository)
        //{
        //    _userManager = userManager;
        //    _kardSession = kardSession;
        //    _passwordHasher = passwordHasher;
        //    _passwordValidator = passwordValidator;
        //    _defaultRepository = defaultRepository;
        //}

        public LoginAppService(

            IKardSession kardSession,
            IPasswordHasher <KuserEntity> passwordHasher,
            IDefaultRepository defaultRepository)
        {
            _kardSession    = kardSession;
            _passwordHasher = passwordHasher;

            _defaultRepository = defaultRepository;
        }
示例#11
0
        public UserController(IHostingEnvironment env,

                              IMemoryCache memoryCache,
                              IRepositoryFactory repositoryFactory,
                              IKardSession kardSession)
            : base(memoryCache, kardSession)
        {
            //HttpContext.Session.SetString("UserId", user.Id.ToString());
            _env = env;
            _repositoryFactory = repositoryFactory;
            _defaultRepository = repositoryFactory.GetRepository <IDefaultRepository>();
        }
示例#12
0
 public LoginController(
     IMemoryCache memoryCache,
     ILoginAppService loginAppService,
     IKardSession kardSession,
     IConfiguration configuration,
     IRepositoryFactory repositoryFactory) : base(memoryCache, kardSession)
 {
     _loginAppService   = loginAppService;
     _configuration     = configuration;
     _repositoryFactory = repositoryFactory;
     _defaultRepository = repositoryFactory.GetRepository <IDefaultRepository>();
 }
示例#13
0
 public EssayController(IHostingEnvironment env,
                        IServiceProvider serviceProvider,
                        IRazorViewEngine razorViewEngine,
                        ITempDataProvider tempDataProvider,
                        IRepositoryFactory repositoryFactory,
                        IMemoryCache memoryCache,
                        IKardSession kardSession,
                        IConfiguration configuration,
                        IBaiduspiderAppService baiduspiderAppService) : base(memoryCache, kardSession)
 {
     _env                   = env;
     _serviceProvider       = serviceProvider;
     _razorViewEngine       = razorViewEngine;
     _tempDataProvider      = tempDataProvider;
     _repositoryFactory     = repositoryFactory;
     _defaultRepository     = repositoryFactory.GetRepository <IDefaultRepository>();
     _configuration         = configuration;
     _baiduspiderAppService = baiduspiderAppService;
 }
示例#14
0
 public BaseController(IMemoryCache memoryCache = null, IKardSession kardSession = null)
 {
     _memoryCache = memoryCache;
     _kardSession = kardSession;
 }
示例#15
0
 public BaseController(ILogger <BaseController> logger, IMemoryCache memoryCache = null, IKardSession kardSession = null)
 {
     _logger      = logger;
     _memoryCache = memoryCache;
     _kardSession = kardSession;
 }