RIA 身份验证期间出现问题
我在 RIA 中构建了一个继承自 DomainService 和 IAuthenticate 的身份验证服务。
问题如下:
当 LoginOperation 由于凭据错误而失败(loginOperation.LoginSuccess 为 false)时,一切正常并向用户报告。
但是,当登录成功时,我会抛出一个非常奇怪的异常:
{System.ServiceModel.DomainServices.Client.DomainOperationException:查询“登录”的加载操作失败。值不能为空。
参数名称:validationErrors ---> System.ArgumentNullException:值不能为空。 参数名称:验证错误 在 System.ServiceModel.DomainServices.Client.QueryCompletedResult..ctor(IEnumerable1Entity, IEnumerable
1includedEntities, Int32totalCount, IEnumerable`1validationErrors)
我不太明白这一点。什么是 IEnumerable validationErrors,它出现在哪里以及为什么它必须是 != null ?在我将身份验证服务从 Nhibernate 移植到实体框架之后,这种情况开始发生。我什至尝试过谷歌搜索这个异常,显然我是迄今为止唯一遇到这个问题的人。
任何帮助将不胜感激。
I've built an authentication service in RIA that inherits from DomainService and IAuthenticate.
The problem is following:
When LoginOperation fails (loginOperation.LoginSuccess is false) due to wrong credentials, everything is ok and it is reported to the user.
However, when login succeeds, I get throw a really weird exception:
{System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'Login'. Value cannot be null.
Parameter name: validationErrors ---> System.ArgumentNullException: Value cannot be null.
Parameter name: validationErrors
at System.ServiceModel.DomainServices.Client.QueryCompletedResult..ctor(IEnumerable1 entities, IEnumerable
1 includedEntities, Int32 totalCount, IEnumerable`1 validationErrors)
I don't really understand this. What is IEnumerable validationErrors, where does it appear and why does it have to be != null ? This started happening after I ported my authentication services from Nhibernate to Entity Framework. I've even tried googling this exception and apparently I'm the only one with this problem so far.
Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
RIA 似乎不支持属性中的 linq 表达式。 IEnumerable Roles 中的 Getter 就是问题所在。必须手动填写;你不能写像
return (from a in User.UserRoles select a.Description).AsEnumerable();
这样的东西,它不会工作。It seems that RIA doesn't support linq expressions in properties. Getter in IEnumerable Roles was the problem. You have to fill it manually; you can't write things like
return (from a in User.UserRoles select a.Description).AsEnumerable();
, it won't work.我也遇到了同样的问题,谢谢你的帮助!!!
但是,当您执行如下所示的 ToList() 时,这是可能的:
I had the same problem, thank you for your help !!!
However, it's possible when you do a ToList() like this: