Serialization Circular exception caused by self-referencing Read-only property?

Here is example, that works (sorry for C#).

Here is example, that works (sorry for C#) Defined class: DataContract(Namespace = "Geo") public class Bound { IgnoreDataMember public Bound { get { return this; } } DataMember public string Name { get; set; } } Created Service Interface (and implementation) ServiceContract public interface IService1 { OperationContract WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat. Json) Bound DoWork(); } public class Service1 : IService1 { public Bound DoWork() { return new Bound { Name = "Test Name" }; } } Edited system. ServiceModel part of app.

Config Started Service Host in Program. Cs using (var sh = new ServiceHost(typeof(Service1))) { sh.Open(); Console. WriteLine("Opened"); Console.ReadLine(); } Started program, opened browser, typed http://localhost:8732/Design_Time_Addresses/JsonSerializationTest/Service1/DoWork and recieved Json-ed test object: {"d":{"__type":"Bound:Geo","Name":"Test Name"}} PS: WebInvokeAttribute is located in System.ServiceModel.Web.

Dll assembly.

Unfortunately, I can't use WCF in this project, but knowing that it works in WCF is intersting... – PlageMan Dec 1 '10 at 21:30 Oh, sorry. Good luck with classic ASP.NET. ) – The_Smallest Dec 1 '10 at 21:51.

You are getting the circular reference Because it's the class Bound with a reference to a property of type Bound. That means it's an endless supply of Bound objects. Not sure on why IgnoreDataMember isn't working right.

I will give this some more time and update my answer if I have any ideas.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions