StrataFrame Forum

Can't change RequiredFields in the BO dropped on a Form

http://forum.strataframe.net/Topic8393.aspx

By Peter Jones - 4/20/2007

Hi,

I made a mistake with the RequiredFields property and wanted to change the 'on form' version just for testing purposes before I changed the actual BO itself. However, it doesn't show in the Properties list when the on form version of the BO is selected.

Is this by design?

Cheers, Peter

By StrataFrame Team - 4/23/2007

Yes, this is by design... the business objects don't allow the RequiredFields to be set on a per-instance basis because then they could be serialized on a by instance basis, and if you changed the fields in the BO's component designer, the changes wouldn't always get inherited by the instances on the forms.  That and the BO class is the central place for the business logic, and the RequiredFields are business logic so...

However, you can certainly modify the RequiredFields collection programmatically for testing purposes (or to make them different on a per-form basis if necessary).  I would recommend copying the code from the InitializeComponent() of the BO because there are a few caveats to the RequireFields collection; namely, you have to use SqlDbType.Text for all System.String properties (at that point, the SqlType doesn't matter, just that it's a string).