Multipul forms and BO's with a ShardDataTableKey


Author
Message
Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
I have run into a problem using the ShardDataTableKey property on BO's.  I created a SFUser control with a ContactBO on the control, tied to the various controls.  The ContactBO on the usercontrol has its ShardDataTableKey set to 'ContactInfo'.  I then create a new SFStandardForm,  drop a ContactBO on the form, set its ShardDataTableKey to 'ContactInfo', drop the user control with the contact informaiton on it.  Run the form.... works great, the BO on the form and the BO on the usercontrol are one and the same and all the logic built into the user control works.

Open one form, select contact1, open form two, select a different contact... the contact data in now the same in both forms.  I can see that this is exactly what the ShardDataTableKey should do....  how should I handle this type of situation?

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
You will need to create some sort of "unique" shared data table key.  For instance, when we use the SharedDataTable key internally (such as within a BusinessBindingSource), we use Guid.NewGuid() to create a string that pretty much guaranteed to be unique.  So, you'll probably want to add a method that gets called after the InitializeComponent within your constructor that will "modify" the SharedDataTable keys for the business objects on the control and form.
Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
Thanks for the info,  will look into doing that.  I knew there had to be a way.

Scott

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No problem.  When you change the SharedDataTable key at runtime, the changes within the BO's data will be immediately reflected.
Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
Just for clairification,  the BOTranslation collection should no longer be used,  right?

The only thing that is shared is the DataTable, NOT the bussiness object and it properties like the BOTranslation did?

BO Properties (includeinformadd, includeinformedit... etc) need to be set on both business objects to function correctly?

Thanks
Scott

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Just for clairification,  the BOTranslation collection should no longer be used,  right?

There is nothing wrong with using the BO Translation collection whatsoever.  However, there may be times that it may work better for you to use the shared data table property.  But the BOTranslations collection can still be used and is in fact something I use often.

The only thing that is shared is the DataTable, NOT the bussiness object and it properties like the BOTranslation did?

Correct.  When you use a shared data table the business objects are two different instances unlike the BO Translations.  When you use the BOTranslations the actual business object referenced in both locations becomes the same instance.

BO Properties (includeinformadd, includeinformedit... etc) need to be set on both business objects to function correctly?

For most cases you are correct...but just keep in mind that there may be a need to set the properties on both since the shared data table shares ONLY the data table used within the BO and not the properties since they are two separate instances.

BTW...I am sorry it took so long to respond.  I just noticed that this item was overlooked somehow Blush

Scott
Scott
StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)StrataFrame User (270 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
Not a problem,  Thanks for the clairfication.

Scott

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
No problem...I am just glad that I saw the post!
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