Search code examples
silverlightwcf-ria-services

Complex type & SilverLight & WCF RIA - most easy way?


I try to operate with WCF RIA + SilverLight (Entity FrameWork + DomainService) On SQL server I have three tables:

users idName idUser

usersStatus idStatus idUser

usersJobs idJobs idUser

So, I have three entities on server/client-side. Is there a way to get all three entities at once, in one object?

I want to do it by Domain Service side, by LINQ (not at SQL Server)?

I tried to create specail proxy-class, but feel trouble to create an instance. Field of proxy-class define in metadata - so I can not get access to it.

I want for example something like that:

public partial class proxyUser
{
internal sealed class proxyUserMetadata
    {

        // Metadata classes are not meant to be instantiated.
        private proxyUserMetadata()
        {
        }

        public users user { get; set; }

        public usersStatus status{ get; set; }

        public EntityCollection <usersJobs> jobs { get; set; }
    }
}

Is there easy way? Thanks.


Solution

  • You can create new class to wrap entities you want to return to client.

    public class CustomEntity
    {
        [Key]
        public Users User { get; set; }
        public UserStatus Status { get; set; }
        public List<UserJobs> Jobs { get; set; }
    }