Another Object Design Question...

Another Object Design Question...

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


reagan123 posted on Wednesday, March 18, 2009

Hello,
Question for everyone.  I have an object that is used to capture information from a form.  The form has two sections (Section 1 and Section 2).

Currently a user creates a new instance of the object and fills out the Section 1 information.  The object is then saved and then another user comes in later and fills out the Section 2 information.

My issue is that there are validation rules that need to apply when section 1 is being filled out and then there are validation rules that apply when section 2 is being filled out. 

What is the best way to approach this?  Any suggestions?

Thanks.

CSLA 3.0.4

Marjon1 replied on Thursday, March 19, 2009

You could create it as a single object with an internal property that tells you which section / stage the object is in and then base your validation rules to also look at that value.

However, it sounds like there is a good case for two different objects here; especially when it comes to security. A user only would only have rights to create details for section 1 and not section 2, and a section 2 user may not be able to edit info in section 1.

Looking forward to others suggestions.

whelzer replied on Thursday, March 19, 2009

I've had a similar issue, we merely used a single object as thats what it is for us (eg an Option Trade).

Front office users enter the Trade,  Back Office enrich it. 

We override CanWriteProperty and have code (albeit fairly complex stuff) which determines whether individual properties can be written  to.  The UI stuff is taken of via ReadWriteAuthorisation control.

This works very well for us seeing as there are huge numbers of properties involved, including  lots of validation.

Can provide more detail if required.

Paul

Copyright (c) Marimer LLC