Hello everyone!
Why is it that methods MobileFormatter.SerializeObject and MobileFormatter.GetObject are scoped as internal rather than public? Wouldn't I need to call these methods from OnGetChildren and OnSetChildren when using backing fields for my child objects?
Thanks for the help!
GA
So, you are not using managed properties in your SilverLight
project?
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Magenic ®
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: GA30
[mailto:cslanet@lhotka.net]
Sent: Wednesday, August 27, 2008 5:21 PM
To: Sergey Barskiy
Subject: [CSLA .NET] CSLA Light - MobileFormatter
Hello everyone!
Why is it that methods MobileFormatter.SerializeObject and
MobileFormatter.GetObject are scoped as internal rather than public? Wouldn't I
need to call these methods from OnGetChildren and OnSetChildren when using
backing fields for my child objects?
Thanks for the help!
GA
Hi Sergey,
I am but only for new types. The many existing ones I am leaving as is (except for adding the serialization code and public constructors). This system is old and currently has a win forms UI. Now however there are some new sub systems we're creating in Silverlight. These new sub systems use types from the old sub systems.
Thanks
OnGet/OnSetChildrent should contain formatter as one of the parameters.
You should be able to use is. Here is what I have (see below). Does
this work for you?
private string
_someField;
protected
override void
OnGetChildren(Csla.Serialization.Mobile.SerializationInfo
info, Csla.Serialization.Mobile.MobileFormatter
formatter)
{
var fieldManagerInfo =
formatter.SerializeObject(_someField);
info.AddChild("_someField",
fieldManagerInfo.ReferenceId);
}
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Magenic ®
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: GA30
[mailto:cslanet@lhotka.net]
Sent: Wednesday, August 27, 2008 5:59 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: CSLA Light - MobileFormatter
Hi Sergey,
I am but only for new types. The many existing ones I am leaving
as is (except for adding the serialization code and public
constructors). This system is old and currently has a win forms UI. Now
however there are some new sub systems we're creating in Silverlight. These new
sub systems use types from the old sub systems.
Thanks
Hi Sergey,
Thanks for the response first and foremost.
I believe I have the latest version of the CSLA code base. And in that code base the SerializeObject method is scoped as internal so I can't call it from the outside. By now I've gotten around the issue by changing against my will the access modifier for this method and GetObject to public. I say against my will because I do my best to avoid changing the framework code so that upgrading does not become problematic. Do you know if this will be changed?????
Thanks
Hmm… The code I pasted into my email does compile on
my machine (in CSLA Light and CSLA projects), and I only have a references to
CSLA DLLs there. Did you try to download the latest source for Csla Light
to see if that works better for you? I looked at the source again, and
these methods in MobileFormatter are public.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: GA30
[mailto:cslanet@lhotka.net]
Sent: Wednesday, August 27, 2008 7:14 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: RE: CSLA Light - MobileFormatter
Hi Sergey,
Thanks for the response first and foremost.
I believe I have the latest version of the CSLA code base. And in that code
base the SerializeObject method is scoped as internal so I can't call it from
the outside. By now I've gotten around the issue by changing against my will
the access modifier for this method and GetObject to public. I say against my
will because I do my best to avoid changing the framework code so that
upgrading does not become problematic. Do you know if this will be changed?????
Thanks
Hi Sergey,
I downloaded the code again and still I see these methods scoped as internal. Where are you downloading your code from? I am getting mine from http://www.lhotka.net/cslalight/download.aspx
Thanks
I see… My bad. I am actually working on it
straight in source code, in 3.6 version. So, essentially I am running
against today’s version of source code… I am sure you will
see the fix in the next code drop, but I am not sure when. Can you run
SVN browser to see if you can see current branch? If so, you can download
the latest source code?
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: GA30
[mailto:cslanet@lhotka.net]
Sent: Wednesday, August 27, 2008 7:30 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: RE: RE: CSLA Light - MobileFormatter
Hi Sergey,
I downloaded the code again and still I see these methods scoped as
internal. Where are you downloading your code from? I am getting mine from http://www.lhotka.net/cslalight/download.aspx
Thanks
Hi Sergey,
Thanks for the info. I will try that and if I can't I will wait for the next version.
One other thing I want to mention to you. One other area I am having problems is with methods ReadOnlyBase.OnGetChildren and ReadOnlyBase.OnSetChildren. In cases whereby the _fieldManager field is null, such as when the read only object only uses backing fields, these methods bomb with null ref exception. I had mentioned to Rocky on his blog that this was happening but I believe he only made changes to BusinessBase because there I see the code checking to make sure _fieldManager is not null before attempting to serialize. It would be great if the same checks can be added to ReadOnlyBase.
Thanks very much for all your help! I really do appreciate it
Thanks. Those issues have been fixed already – I just
looked in source.
Sergey Barskiy
Principal Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Magenic ®
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: GA30
[mailto:cslanet@lhotka.net]
Sent: Wednesday, August 27, 2008 7:48 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: RE: RE: RE: CSLA Light - MobileFormatter
Hi Sergey,
Thanks for the info. I will try that and if I can't I will wait for the next
version.
One other thing I want to mention to you. One other area I am having
problems is with methods ReadOnlyBase.OnGetChildren and
ReadOnlyBase.OnSetChildren. In cases whereby the _fieldManager field is null,
such as when the read only object only uses backing fields, these methods bomb
with null ref exception. I had mentioned to Rocky on his blog that this was
happening but I believe he only made changes to BusinessBase because there I
see the code checking to make sure _fieldManager is not null before attempting
to serialize. It would be great if the same checks can be added to
ReadOnlyBase.
Thanks very much for all your help! I really do appreciate it
Copyright (c) Marimer LLC