小编Sha*_*ram的帖子

从两个不同的词典中获取相同的键

我有两个不同的词典:

Dictionary<int, User> X;
Dictionary<int, User> Y;
Run Code Online (Sandbox Code Playgroud)

我想使用LINQ从它们获取相同键的列表.

c# linq dictionary

3
推荐指数
1
解决办法
267
查看次数

Nest JS - 无法向中间注入服务

我创建了一个auth middlewere来检查每个请求,中间是使用服务器(只有在req.connection中找不到数据).我正在尝试将服务注入到我的中间,我一直得到相同的错误"Nest无法解析AuthenticationMiddleware(?)的依赖关系.请验证当前上下文中是否有[0]参数可用."

AuthenticationModule:

@Module({
   imports: [ServerModule],
   controllers: [AuthenticationMiddleware],
})
export class AuthenticationModule {
}
Run Code Online (Sandbox Code Playgroud)

AuthenticationMiddleware:

@Middleware()
export class AuthenticationMiddleware implements NestMiddleware {

constructor(private service : UserService) {}

resolve(): (req, res, next) => void {
 return (req, res, next) => {
   if (req.connection.user)
    next();

  this.service.getUsersPermissions()     
  }
}
Run Code Online (Sandbox Code Playgroud)

ServerModule:

@Module({
 components: [ServerService],
 controllers: [ServerController],
 exports: [ServerService]
})    
 export class ServerModule {}
Run Code Online (Sandbox Code Playgroud)

ApplicationModule:

@Module({
  imports: [
    CompanyModule,
    ServerModule,
    AuthenticationModule
  ]
})

export class ApplicationModule implements NestModule{
  configure(consumer: MiddlewaresConsumer): void {
  consumer.apply(AuthenticationMiddleware).forRoutes(
      { path: …
Run Code Online (Sandbox Code Playgroud)

node.js nestjs

0
推荐指数
1
解决办法
1749
查看次数

标签 统计

c# ×1

dictionary ×1

linq ×1

nestjs ×1

node.js ×1