Ok, so everything is working for you?
Regards,
Michael
On 5/22/06, Eyal Peleg <[EMAIL PROTECTED]> wrote:
>
> thanks for your effort,
> your code is more or less like what I have created.
>
> Instead of having
>
>
> public override Type[] SerializableTypes {
> get {
> return new Type[] { typeof(MyAjaxClass) };
> }
> }
> I am using something like:
>
> private Type[] serializableTypes = new Type[] { typeof(MyAjaxClass) };
>
> and
>
>
>
> public override Type[] SerializableTypes {
> get {
> return serializableTypes };
> }
> }
>
>
>
> which I think is better for performance (bcause you call this property very
> often.
>
> are you using skype ? (my username is epeleg)
>
> I would love to talk to you about two idea's for improvements that I have.
>
>
> as for my original probelm,
> when I closed my development environment and reopened it,
> everything worked as I expected.
>
> It must have been something with the web.config not being loaded properly or
> some caching issue.
>
> Thanks again,
> Eyal Peleg
>
> On 5/22/06, Michael Schwarz <[EMAIL PROTECTED]> wrote:
> >
> Hi,
>
> I have done a short example here, see the attached files.
>
> - MyAjaxClass.cs is the class I want to serialize.
>
> - IEC.cs is the class I want to return, a list of MyAjaxClass.
>
> - MyAjaxClassConverter is the converter that will add some special
> client-side functions to the class, like the GetAgeInDays.
>
>
> In web.config I added this:
>
> <jsonConverters>
> <add type="MyAjaxClassConverter,App_Code" />
> </jsonConverters>
>
>
> This is working great, maybe you are not using the latest DLL?
>
> Regards,
> Michael
>
>
>
> On 5/22/06, epeleg <[EMAIL PROTECTED]> wrote:
> >
> > Hi Michael,
> >
> > even after following all your advice I am still having trouble with
> > some of my converters just being ignored:
> >
> > I have a class C that has a property "prop" that populates itself upon
> > request (it is a very heavy proccess and it is usually not needed),
> > then I have another class IEC which implements IEnumerable<C> for the
> > previous class.
> >
> > I have set up a converter for the class C,
> > one of the effects of the converter is that it is not supposed to
> > serialize the problematic property as it is not needed on the client
> > side.
> >
> > when i place a break point insed that get accessor for "prop" it hits
> > the breakpoint with the following call stack (viewable by selecting
> > "Show External Code"):
> > Starting in the middle I can see that:
> >
> >
> AjaxPro.2.DLL!AjaxPro.IEnumerableConverter.Serialize(object
> o =
> > {MyApp.BLL.IEC}) + 0x126 bytes
> > which means that the default IEnumerableConverter is serializing an
> > object of the type IEC (that implements implements IEnumerable<C>) -
> > which is o.k.
> >
> > then
> >
> AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.Serialize(object
> o =
> > {MyApp.BLL.C}) + 0x3b bytes
> > which is the AjaxPro.IEnumerableConverter's attempt to serialize the
> > instance of C which he gets from the enumerator and this is again o.k.
> >
> > then
> >
> AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.SerializeInternal
> (object o =
> > {MyApp.BLL.C}) + 0x3f bytes
> >
> > followed by
> >
> AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.SerializeValue(object
> o =
> > {Newman.BLL.Email}, System.Text.StringBuilder sb =
> > {{"__type":" MyApp.BLL.C, MyApp.BLL, Version= 1.0.0.0, Culture=neutral,
> > PublicKeyToken=null","Prop":}) + 0x712 bytes
> >
> > the contents of sb here is already probelmatic but i guess it was
> > actually created furthe in the next step of the call stack which is
> >
> AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.SerializeCustomObject(object
> > o = {MyApp.BLL.C }, System.Text.StringBuilder sb =
> > {{"__type":" MyApp.BLL.C, MyApp.BLL, Version=1.0.0.0, Culture=neutral,
> > PublicKeyToken=null","Prop":}) + 0x428 bytes
> >
> > and this means that for some reason it did not call my own converter
> > but decided to use the
> > AjaxPro.JavaScriptSerializer.SerializeCustomObject
> instead.
> >
> > how can I tell why is this happening ?
> >
> > Eyal Peleg
> > JSBugHunter.Com
> >
> > X-Google-Language: ENGLISH,ASCII-7-bit
> > Received: by 10.11.53.63 with SMTP id b63mr119388cwa;
> > Mon, 22 May 2006 03:51:58 -0700 (PDT)
> > X-Google-Token: NATenwwAAABqJ7GxRtDG0Q5Itmr2tM3V
> > Received: from 88.152.209.217 by j33g2000cwa.googlegroups.com with HTTP;
> > Mon, 22 May 2006 10:51:58 +0000 (UTC)
> > From: "epeleg" < [EMAIL PROTECTED]>
> > To: "Ajax.NET Professional" <[email protected]>
> > Subject: debugging convertes
> > Date: Mon, 22 May 2006 10:51:58 -0000
> > Message-ID:
> <[EMAIL PROTECTED]>
> > User-Agent: G2/0.2
> > X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
> Maxthon; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR
> 2.0.50727),gzip(gfe),gzip(gfe)
> > Mime-Version: 1.0
> > Content-Type: text/plain
> >
> > Hi Michael,
> >
> > even after following all your advice I am still having trouble with
> > some of my converters just being ignored:
> >
> > I have a class C that has a property "prop" that populates itself upon
> > request (it is a very heavy proccess and it is usually not needed),
> > then I have another class IEC which implements IEnumerable<C> for the
> > previous class.
> >
> > I have set up a converter for the class C,
> > one of the effects of the converter is that it is not supposed to
> > serialize the problematic property as it is not needed on the client
> > side.
> >
> > when i place a break point insed that get accessor for "prop" it hits
> > the breakpoint with the following call stack (viewable by selecting
> > "Show External Code"):
> > Starting in the middle I can see that:
> >
> > AjaxPro.2.DLL!AjaxPro.IEnumerableConverter.Serialize
> (object o =
> > {MyApp.BLL.IEC}) + 0x126 bytes
> > which means that the default IEnumerableConverter is serializing an
> > object of the type IEC (that implements implements IEnumerable<C>) -
> > which is o.k.
> >
> > then
> >
> AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.Serialize(object
> o =
> > {MyApp.BLL.C}) + 0x3b bytes
> > which is the AjaxPro.IEnumerableConverter's attempt to serialize the
> > instance of C which he gets from the enumerator and this is again o.k.
> >
> > then
> >
> AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.SerializeInternal(object
> o =
> > {MyApp.BLL.C}) + 0x3f bytes
> >
> > followed by
> > AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.SerializeValue
> (object o =
> > {Newman.BLL.Email}, System.Text.StringBuilder sb =
> > {{"__type":"MyApp.BLL.C, MyApp.BLL, Version= 1.0.0.0, Culture=neutral,
> > PublicKeyToken=null","Prop":}) + 0x712 bytes
> >
> > the contents of sb here is already probelmatic but i guess it was
> > actually created furthe in the next step of the call stack which is
> >
> AjaxPro.2.DLL!AjaxPro.JavaScriptSerializer.SerializeCustomObject
> (object
> > o = {MyApp.BLL.C }, System.Text.StringBuilder sb =
> > {{"__type":"MyApp.BLL.C, MyApp.BLL, Version=1.0.0.0, Culture=neutral,
> > PublicKeyToken=null","Prop":}) + 0x428 bytes
> >
> > and this means that for some reason it did not call my own converter
> > but decided to use the
> > AjaxPro.JavaScriptSerializer.SerializeCustomObject
> instead.
> >
> > how can I tell why is this happening ?
> >
> > Eyal Peleg
> > JSBugHunter.Com
> >
> >
> > >
> >
>
>
> --
> Best regards | Schöne Grüße
> Michael
>
> Microsoft MVP - Most Valuable Professional
> Microsoft MCAD - Certified Application Developer
>
> http://weblogs.asp.net/mschwarz/
> http://www.schwarz-interactive.de/
> mailto: [EMAIL PROTECTED]
>
>
>
>
--
Best regards | Schöne Grüße
Michael
Microsoft MVP - Most Valuable Professional
Microsoft MCAD - Certified Application Developer
http://weblogs.asp.net/mschwarz/
http://www.schwarz-interactive.de/
mailto:[EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---