views:

78

answers:

2

I am making ajax calls to my webservice (using MS ajax framework - Telerik comps uses it actually). I am returning one of the Entity classes generated by the dbml. It used to work fine, but when I added the associations it started throwing an exception on the server, saying "a circular reference was detecting when serializing type "

I worked around it for now, but I'd really like to know what is happening. Thanks

A: 

This is because the relation is mapped with navigation properties both ways. ie you can use:

myCustomer.Orders

but also

order.Customer

You could try marking one of them non-public in the dbml, then if you need a public property, create it in the partial class, so you can mark the property with XmlIgnoreAttribute:

partial class Order
{
    [XmlIgnore]
    public Customer Customer
    {
        get { return InternalCustomer; }
        set { InternalCustomer = value; }
    }
}
Sander Rijken
A: 

it does not work. But this will hopefully do http://www.west-wind.com/WebLog/posts/147218.aspx

HowHow
_what_ doesn't work?
John Saunders