Change the instance of the main BO in a form.


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Create a strataframe user control and drop all of your controls onto the user control.  Then drop that user control on your form and use the BOTranslations property.  This has that type of logic...there is more to  replacing an instance that just changing the property instance, all of the events, field references, etc. have to be reflectively changed in order for this to work.  This is not a SF related issue, this is just a .NET related situation where you want to change the instance of an object.  You can do this manually through the BusinessObjectTranslator class, but this is a much more complicated approach.  This is the class that is used by the User Control and ChildFormDialog when translating those business objects from one instance to another (MicroFour.StrataFrame.UI.WIndows.Forms.BusinessObjectTranslator).
George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Hi all.

What I am trying to do is this: I drop a BO component (let's say CustomerBO) on the form and bind it in different controls. How can change the instance of this BO? I need to implement a method like this:

private CustomerBO mCustomer;
public void ChangeCustomer(CustomerBO newCustomer)
{
 mCustomer = newCustomer;
}

Where mCustomer is the object which is dropped on the form and bound to all controls, and newCustomer is an object created somewhere outside the form.

After the above assignment, the controls are still bound to the previous instance, and the Save method of the form still saves the original instance. Is there a way of "centrally" changing the instance of the BO (Something like the DataSource property of a BindingSource?)? Do I have to loop all controls and assign it manually?

Thanks in advance.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search