Exemplo n.º 1
0
        public AuthenticationController(DAL.ChatContext db, IAntiforgery antiforgery)
        {
            if (db == null || antiforgery == null)
            {
                throw new ArgumentException();
            }

            this._db          = db;
            this._antiforgery = antiforgery;
        }
Exemplo n.º 2
0
        public UserController(DAL.ChatContext db, IAuthorizationService authorizationService, IMapper mapper)
        {
            if (db == null || authorizationService == null || mapper == null)
            {
                throw new ArgumentException();
            }

            this._db = db;
            this._authorizationService = authorizationService;
            this._mapper = mapper;
        }
Exemplo n.º 3
0
        public ChatHub(DAL.ChatContext db, ILogger <ChatHub> logger,
                       ChatHubStorage chatHubStorage)
        {
            if (db == null || logger == null ||
                chatHubStorage == null)
            {
                throw new ArgumentException();
            }

            this._db             = db;
            this._logger         = logger;
            this._chatHubStorage = chatHubStorage;

            // AutoMapper configuration:
            var mapperConfig = new MapperConfiguration((config) =>
            {
                config.CreateMap <User, DAL.User>();
                config.CreateMap <DAL.User, User>();
                config.CreateMap <Message, DAL.Message>();
                config.CreateMap <DAL.Message, Message>();
            });

            this._mapper = mapperConfig.CreateMapper();
        }