4

I am having an issue exposing my nested object VIA WCF RIA Service.

Example of business objects (not tied to DB)

public class User
{
    public string Name { get; set; }
    public Product Product { get; set; }

}

The user object will come to my client object, however the product does not. How can I resolve this?

Pawan
  • 293
  • 1
  • 3
  • 13

4 Answers4

1

You can also do it in the query like this:

var MyUsers = DataContext.Users.Include("Product").ToList();
JasonRShaver
  • 4,344
  • 3
  • 32
  • 39
0

Do you use the [Include] tag in User metadata? It will identify it as information that should be sent over the network.

R Kitty
  • 176
  • 3
  • Yes I added Include but to do so you are required to use the [Association] attribute and in this case there really isn't a mapping between person and product. Can I just fake the relationship? – Pawan May 11 '11 at 23:13
0

If there isnt a mapping, use a LINQ query: some pseudocode

var user= from u in User join Product on User.Key = Product.Key
select u;

Greg
  • 2,654
  • 3
  • 36
  • 59
0
[Include]
public Product Product { get; set; }
Keith Adler
  • 20,880
  • 28
  • 119
  • 189