Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 927
  • Last Modified:

Silverlight, RIA services

Hi,

I have a Silverlight application and want to use RIA services to retrieve some data from the login account. I have added the following method to the AuthenticationDomainService class:

        public string[] getRoles()
        {
            string usr = Membership.GetUser().UserName;
            string[] rol = Roles.GetRolesForUser(usr);
            return rol;
        }

which however gives the build error

Type 'String' is not a valid entity type.  Entity types cannot be a primitive type or a simple type like string or Guid.

How can I correct this?
Is there a better way to work with the user data from Silverlight?

Best regards
RTSol
0
RTSol
Asked:
RTSol
1 Solution
 
Gautham JanardhanCommented:
can you post the RIA service code. it look like you are trying to add a domain Operation , which needs an entity as a return type.
PLease put the attribute [ServiceOperation] on your method and it should work.
0
 
RTSolAuthor Commented:
Hi,

Thanks for the tip. It found that the attribute [ServiceOperation] has been replaced by [Invoke]. My code now looks like this:

        [Invoke]
        public string[] getRoles()
        {
            string usr = Membership.GetUser().UserName;
            string[] rol = Roles.GetRolesForUser(usr);
            return rol;
        }

and it works fine.

Best regards
RTSol
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now