I have a problem which(I guess) may be related with api controller.
public class AccountController : ApiController
{
private readonly UserAccountService<HierarchicalUserAccount> userAccountService;
private readonly AuthenticationService<HierarchicalUserAccount> authSvc;
public AccountController(AuthenticationService<HierarchicalUserAccount> authSvc)
{
authSvc = authSvc;
userAccountService = authSvc.UserAccountService;
}
[HttpGet]
public async Task<HttpResponseMessage> Get()
{
...
HierarchicalUserAccount account;
if (userAccountService.AuthenticateWithUsernameOrEmail("name@mail.com", "123456", out account))
{
authSvc.SignIn(account, false); //ERROR because authSvc is null
}
return await ... ;
}
When constructor called userAccountService and authSvc get their values, but in get method authSvc becomes null and userAccountService works as expect.
Thanks.