Filip Kinsky
unread,Mar 12, 2009, 6:11:16 AM3/12/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to NhLambdaExtensionsUsers
Hello, I'm just evaluating NHLambdaExtensions, but my first attempt
resulted in strange exception I'm not able to solve at the moment. I
have simple User class like this:
public class User: PersistentObject
{
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string PasswordHash { get; set; }
public IList<Role> Roles{ get; private set;}
...
}
and repository which makes use of NHLambda:
public class UserRepository: RepositoryBase<User>, IUserRepository
{
public User FindByUserNameAndPasswordHash(string userName, string
pwdHash)
{
return FindOne(DetachedCriteria.For<User>()
.Add<User>(u => u.UserName == userName &&
u.PasswordHash == pwdHash));
}
}
I get following exception when calling this repository method from my
application:
Could not determine member from (u.UserName = value
(App.Service.Persistence.Repositories.Core.Security.UserRepository
+<>c__DisplayClass0).usr)
Am I doing something wrong? I was trying to look in NHLAmbda source,
but didn't find anythink yet..
the stack trace for exception:
[Exception: Could not determine member from (u.UserName = value
(PromoSystemX.Service.Persistence.Repositories.Core.Security.UserRepository
+<>c__DisplayClass0).usr)]
NHibernate.LambdaExtensions.ExpressionProcessor.FindMemberExpression
(Expression expression) +463
NHibernate.LambdaExtensions.ExpressionProcessor.ProcessSimpleExpression
(BinaryExpression be) +18
NHibernate.LambdaExtensions.ExpressionProcessor.ProcessBinaryExpression
(BinaryExpression expression) +37
NHibernate.LambdaExtensions.ExpressionProcessor.ProcessLambdaExpression
(LambdaExpression expression) +68
NHibernate.LambdaExtensions.DetachedCriteriaExtensions.Add
(DetachedCriteria criteria, Expression`1 expression) +24
PromoSystemX.Service.Persistence.Repositories.Core.Security.UserRepository.FindByUserNameAndPasswordHash
(String userName, String pwdHash) in C:\Develop\PromoSystemX\source
\PromoSystemX.Service\Persistence\Repositories\Core\Security
\UserRepository.cs:18
PromoSystemX.Service.Core.Security.AuthenticationService.AuthenticateUser
(String userName, String passwordHash) in C:\Develop\PromoSystemX
\source\PromoSystemX.Service\Core\Security\AuthenticationService.cs:33
PromoSystemX.Web.Controllers.AccountMembershipService.ValidateUser
(String userName, String password) in C:\Develop\PromoSystemX\source
\PromoSystemX.Web\Controllers\AccountMembershipService.cs:36
PromoSystemX.Web.Controllers.AccountController.ValidateLogOn(String
userName, String password) in C:\Develop\PromoSystemX\source
\PromoSystemX.Web\Controllers\AccountController.cs:208
PromoSystemX.Web.Controllers.AccountController.LogOn(String
userName, String password, Boolean rememberMe, String returnUrl) in C:
\Develop\PromoSystemX\source\PromoSystemX.Web\Controllers
\AccountController.cs:59
lambda_method(ExecutionScope , ControllerBase , Object[] ) +245
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase
controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod
(ControllerContext controllerContext, ActionDescriptor
actionDescriptor, IDictionary`2 parameters) +24
System.Web.Mvc.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7
() +52
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter
(IActionFilter filter, ActionExecutingContext preContext, Func`1
continuation) +254
System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9
() +19
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters
(ControllerContext controllerContext, IList`1 filters,
ActionDescriptor actionDescriptor, IDictionary`2 parameters) +192
PromoSystemX.Web.Util.AppControllerActionInvoker.InvokeActionMethodWithFilters
(ControllerContext controllerContext, IList`1 filters,
ActionDescriptor actionDescriptor, IDictionary`2 parameters) in C:
\Develop\PromoSystemX\source\PromoSystemX.Web\Util
\AppControllerActionInvoker.cs:38
System.Web.Mvc.ControllerActionInvoker.InvokeAction
(ControllerContext controllerContext, String actionName) +399
System.Web.Mvc.Controller.ExecuteCore() +126
System.Web.Mvc.ControllerBase.Execute(RequestContext
requestContext) +27
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute
(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase
httpContext) +151
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
+57
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest
(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute
() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +75