void AddNew()

void AddNew()

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


Michael Hildner posted on Tuesday, November 11, 2008

Greetings,

I've been on 2.1.4 for a while, delving into 3.6. I see that .AddNew() returns void now, instead of a child object.

Is this discussed anywhere? I'm used to creating a child and setting some properties - trying to figure out how to access the newly created child.

Thanks,

Mike

skagen00 replied on Tuesday, November 11, 2008

Hi Mike,

I've been using the most recent versions so I don't have the compare and contrast...

But I need to override AddNewCore and just do a ChildObject.NewChildObject(), this.Add(newChildObject), return newChildObject;

AddNew will work, then.

Hope that helps!

Chris Hlusak

Michael Hildner replied on Tuesday, November 11, 2008

Thanks for the reply Chris.

That's what I'm used to doing in 2.1.4, but if I try to return an object instead of void from AddNewCore, I get a compile error - return type must be 'void' to match overridden member.

I must be missing something...

Mike

sergeyb replied on Tuesday, November 11, 2008

Maybe you are running against Csla for Silverlight version?  That one is void because of asynchronous processing.

 

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: Michael Hildner [mailto:cslanet@lhotka.net]
Sent: Tuesday, November 11, 2008 7:02 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] void AddNew()

 

Thanks for the reply Chris.

That's what I'm used to doing in 2.1.4, but if I try to return an object instead of void from AddNewCore, I get a compile error - return type must be 'void' to match overridden member.

I must be missing something...

Mike



Michael Hildner replied on Tuesday, November 11, 2008

You're right Sergey, it is the Silverlight version - I should have mentioned that.

Oh man, sorry, but here's a newbie question - how do I access my new child? If you could point me to a link or something, that would be great.

Thanks,

Mike

 

sergeyb replied on Tuesday, November 11, 2008

What type of access are you looking for?  I do not have an immediate answer, but I might be able to point you in a right direction…

 

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: Michael Hildner [mailto:cslanet@lhotka.net]
Sent: Tuesday, November 11, 2008 8:31 PM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: void AddNew()

 

You're right Sergey, it is the Silverlight version - I should have mentioned that.

Oh man, sorry, but here's a newbie question - how do I access my new child? If you could point me to a link or something, that would be great.

Thanks,

Mike

 



Michael Hildner replied on Wednesday, November 12, 2008

Well, I'm used to creating children through .AddNew, then setting some properties on the new child. Just trying to get a reference to the new child.

sergeyb replied on Wednesday, November 12, 2008

Ahhh.  I see.  You will not be able to accomplish this task this way.  You will probably need to do this in Child_Create in SL.  The same approach should work in .NET as well though.

 

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: Michael Hildner [mailto:cslanet@lhotka.net]
Sent: Wednesday, November 12, 2008 9:38 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] RE: RE: void AddNew()

 

Well, I'm used to creating children through .AddNew, then setting some properties on the new child. Just trying to get a reference to the new child.

Copyright (c) Marimer LLC