Hello,
I've got a console application on wich I use the IAuthenticationService to login... I correctly login and it saves the principal but then I call the entitymanager and execute a method I got an exception that the user is not logged in...
in my program.cs I've a configure method that's
private void Configure()
{
IAuthenticationService authenticationService = IoC.Get<IAuthenticationService>();
if (authenticationService != null)
{
string userName = ConfigurationManager.AppSettings["username"];
string password = ConfigurationManager.AppSettings["password"];
myLoginCredential loginCredential = new myLoginCredential(userName, password);
authenticationService.Login(loginCredential); //here it logs and the AuthenticationContext is ok
}
}
When I call my repository
private bool PopulateSqlData(DateTime data)
{
bool isOk = false;
var sw = new Stopwatch();
sw.Start();
try
{
repository.GeneratoreReportmyMethod(id, data);
}
catch (Exception ex)
{
NLog.LogManager.GetLogger("exception").ErrorException("PopulateSqlData", ex);
return false;
}
sw.Stop();
string str = string.Format("Tempo impiegato per popolare le tabelle dati {0}", sw.Elapsed.ToString());
NLog.LogManager.GetLogger("generatore").Info(str);
return isOk;
}
I get a call to the loginmanager on the server
public IPrincipal Login(ILoginCredential credential, EntityManager entityManager)
{
//credential is null here
}
In my old version using DAF I was calling LinkForAuthentication...what am I doing wrong?
Thanks