开发者

Problem during RIA authentication

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 canno开发者_运维知识库t 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.


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.


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
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜