RIA Services for transmitting non DB object-graph
- by Mike Gates
I have been getting into RIA services because I thought it would simplify dealing with the services layer of web applications I wish to build. I see lots of examples out there showing how to create DomainService classes which expose and consume entities that have some kind of relational database backing, and therefore have foreign-key relationships. However, I would like to know how to expose and consume normal object graphs...objects that contain references to eachother but don't have foreign keys.
For example, say I want a service operation called "GetFolderInformation(string pathToFolder)". I want this to return a custom object called "FolderInformation" structured with:
- string Name
- IEnumerable<FileInformation> Files
I cannot get this to work because it seems that RIA wants to deal with entities that have foreign key relationships. Why? Why can't the serializer just see my object references and recreate that in the proxy on the other side?
Data exists behind service layers that doesn't necessarily have foreign key relationships...like folder/file for example.
EDIT: I realized I hadn't asked my question! My question is, is there a way to do what I am trying to do?