CSLA .NET

From Rockford Lhotka's Expert C# 2005 and VB 2005 Business Objects books

Welcome to CSLA .NET Sign in | Join | Help
in Search

CSLA Light - MobileFormatter

Last post 08-27-2008, 6:51 PM by sergeyb. 9 replies.
Sort Posts: Previous Next
  •  08-27-2008, 4:20 PM 25789

    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

     

  •  08-27-2008, 4:50 PM 25791 in reply to 25789

    RE: CSLA Light - MobileFormatter

    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

     



  •  08-27-2008, 4:59 PM 25792 in reply to 25791

    Re: 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

  •  08-27-2008, 5:59 PM 25794 in reply to 25792

    RE: RE: CSLA Light - MobileFormatter

    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



  •  08-27-2008, 6:13 PM 25795 in reply to 25794

    Re: 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

     

  •  08-27-2008, 6:23 PM 25796 in reply to 25795

    RE: RE: RE: CSLA Light - MobileFormatter

    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

    cid:_2_0648EA840648E85C001BBCB886257279
    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

     



  •  08-27-2008, 6:30 PM 25797 in reply to 25796

    Re: 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

  •  08-27-2008, 6:34 PM 25798 in reply to 25797

    RE: RE: RE: RE: CSLA Light - MobileFormatter

    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

    cid:_2_0648EA840648E85C001BBCB886257279
    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



  •  08-27-2008, 6:48 PM 25799 in reply to 25798

    Re: 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

     

  •  08-27-2008, 6:51 PM 25800 in reply to 25799

    RE: RE: RE: RE: RE: CSLA Light - MobileFormatter

    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

     



View as RSS news feed in XML

Please contact Magenic for your .NET consulting and CSLA .NET mentoring needs.
Please consider making a donation to help support the ongoing development of CSLA .NET.

Make donation through PayPal - it's fast, free and secure!
Why donate?
Powered by Community Server, by Telligent Systems