RIA 身份验证期间出现问题

发布于 2024-09-04 23:07:36 字数 734 浏览 3 评论 0原文

我在 RIA 中构建了一个继承自 DomainService 和 IAuthenticate 的身份验证服务。

问题如下:

当 LoginOperation 由于凭据错误而失败(loginOperation.LoginSuccess 为 false)时,一切正常并向用户报告。

但是,当登录成功时,我会抛出一个非常奇怪的异常:

{System.ServiceModel.DomainServices.Client.DomainOperationException:查询“登录”的加载操作失败。值不能为空。

参数名称:validationErrors ---> System.ArgumentNullException:值不能为空。 参数名称:验证错误 在 System.ServiceModel.DomainServices.Client.QueryCompletedResult..ctor(IEnumerable1Entity, IEnumerable1includedEntities, 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, IEnumerable1 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扮仙女 2024-09-11 23:07:36

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.

扛起拖把扫天下 2024-09-11 23:07:36

我也遇到了同样的问题,谢谢你的帮助!!!

但是,当您执行如下所示的 ToList() 时,这是可能的:

[DataMember]
public IEnumerable<string> Roles
{
    get
    {
        return ApplicationRoles.Select(r => r.Name).ToList();
    }
    set
    {
        // TODO
    }
}

I had the same problem, thank you for your help !!!

However, it's possible when you do a ToList() like this:

[DataMember]
public IEnumerable<string> Roles
{
    get
    {
        return ApplicationRoles.Select(r => r.Name).ToList();
    }
    set
    {
        // TODO
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文