SilverLight Help

SilverLight Help

Old forum URL: forums.lhotka.net/forums/t/7710.aspx


SouthSpawn posted on Wednesday, September 30, 2009

I am doing the following.
 
                    GetContentFromDOM();
 
                    Csla.Silverlight.CslaDataProvider p;
                   
                    p = this.Resources["CompanyData"] as Csla.Silverlight.CslaDataProvider;
 
                    Company c = p.Data as Company;
 
                    c.MyCHILDClass.Summary = _campaignContent;
         
                    p.Save();
 
When I do this, it will save the "c.MyCHILDClass.Summary" child data.
But for some reason, it will not save the "Parent" data under the "c.MyProperty".
 
If the remove the
 
            Company c = p.Data as Company;
 
            c.MyCHILDClass.Summary = _campaignContent;
 
It then will save the parent data.
 
Any thoughts??
 
 
 

sergeyb replied on Thursday, October 01, 2009

Maybe is it is not Dirty?  Technically when you just change Summary object, IsSelfDirty for company is still false.

 

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: SouthSpawn [mailto:cslanet@lhotka.net]
Sent: Wednesday, September 30, 2009 10:27 PM
To: Sergey Barskiy
Subject: [CSLA .NET] SilverLight Help

 

I am doing the following.

 

                    GetContentFromDOM();

 

                    Csla.Silverlight.CslaDataProvider p;
                   
                    p = this.Resources["CompanyData"] as Csla.Silverlight.CslaDataProvider;

 

                    Company c = p.Data as Company;

 

                    c.MyClass.Summary = _campaignContent;
         
                    p.Save();

 

When I do this, it will save the "c.MyClass.Summary" child data.

But for some reason, it will not save the "Parent" data under the "c.MyProperty".

 

Any thoughts??

 

 

 



SouthSpawn replied on Thursday, October 01, 2009

Sergey, I basically have an object that looks like this.
 
=====================================
a.ChildObject.AnotherChild.MyDescriptions
=====================================

I did the following check.
 
a.IsSelfDirty = true
 
a.ChildObject.IsSelfDirty = false
 
a.ChildObject.AnotherChild = true

In my DataPortal_Update method on the main parent object.
 
I am including the "FieldManager.UpdateChildren();"

All fields for the main parent object "a" are two way databounded to the XAML.

I have to set the a.ChildObject.AnotherChild.MyDescriptions "Manually, because the data is coming from an HTML WYSIWYG editior. So I use the DOM to handle this.

Now, when I "manually" set the a.ChildObject.AnotherChild.MyDescriptions = "MyDescription";

Any changes maid to the "Databinded" data in main parent object will not happen.

But if I comment on the code that is manually setting the "a.ChildObject.AnotherChild.MyDescriptions" property, now the main parent data will save.

I hope I explained this right :) :)


 

sergeyb replied on Thursday, October 01, 2009

It all looks OK to me.  I’d recommend to set a breakpoint in a.DataPortal_Update to see what is happening there.

 

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: SouthSpawn [mailto:cslanet@lhotka.net]
Sent: Thursday, October 01, 2009 10:13 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: SilverLight Help

 

Sergey, I basically have an object that looks like this.

 

=====================================

a.ChildObject.AnotherChild.MyDescriptions

=====================================

I did the following check.

 

a.IsSelfDirty = true

 

a.ChildObject.IsSelfDirty = false

 

a.ChildObject.AnotherChild = true

In my DataPortal_Update method on the main parent object.

 

I am including the "FieldManager.UpdateChildren();"

All fields for the main parent object "a" are two way databounded to the XAML.

I have to set the a.ChildObject.AnotherChild.MyDescriptions "Manually, because the data is coming from an HTML WYSIWYG editior. So I use the DOM to handle this.

Now, when I "manually" set the a.ChildObject.AnotherChild.MyDescriptions = "MyDescription";

Any changes maid to the "Databinded" data in main parent object will not happen.


But if I comment on the code that is manually setting the "a.ChildObject.AnotherChild.MyDescriptions" property, now the main parent data will save.


I hope I explained this right :) :)


 



Copyright (c) Marimer LLC