-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current threads of different cultures may cause potential problems. #65
Comments
I do not see how should this be a concern NHibernate.AspNet.Identity. Can you elaborate? Explain what it may cause for NHibernate.AspNet.Identity features and why should it by handled by it rather than by the application code. |
Changing the culture of the unit test thread context will reproduce this problem. NHibernate.AspNet.Identity/source/NHibernate.AspNet.Identity.Tests/UserStoreTest.cs Lines 237 to 244 in 28b5907
[TestMethod]
public void FindByName()
{
var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(this._session));
userManager.Create(new ApplicationUser() { UserName = "admin", Email = "[email protected]", EmailConfirmed = true }, "Welcome");
Thread.CurrentThread.CurrentCulture = new CultureInfo("tr");
var x = userManager.FindByName("admin");
Assert.IsNotNull(x);
Assert.IsTrue(userManager.IsEmailConfirmed(x.Id));
}
Expected: not null
But was: null
at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)
at NUnit.Framework.Assert.IsNotNull(Object anObject)
at NHibernate.AspNet.Identity.Tests.UserStoreTest.FindByName() |
If the user's current thread culture changes, NHibernate.AspNet.Identity may have problems. Also exists in RoleStore. The specific content is in the issue I mentioned earlier. nhibernate/nhibernate-core#1967
|
A proper fix for this case could be to use something like Criteria/QueryOver In fact, I think it is an error for NHibernate.AspNet.Identity to try forcing an insensitive comparison for user names and roles, as illustrated by this issue. It should let the database be responsible for this, since this behavior can in many cases be adjusted in the database (by example, with SQL-Server, by adjusting the collation of columns). Of course, removing these offending |
see nhibernate/nhibernate-core#1967
The text was updated successfully, but these errors were encountered: