How can I translate this into a person or a piece of furniture? (or should I even try?)
If you understand correctly, you probably should not try to convert these fields to specific objects, since the nature of your application is so dynamic. If stored procedures are able to determine which combination of fields belongs to which tables, then large.
If you can change the database schema, I would suggest coming up with something much more dynamic. Instead of having a separate table for each type of dynamic object, I would create the following schema:
Object { ID Name ... (clientID, etc.) ... } Property { ID ObjectID Name DBType (int, string, object-id, etc.) FormType ( textbox, checkbox, etc.) [FormValidationRegex] <== optional, could be used by field controls Value }
If you cannot change the database schema, you can apply the following to the old system using stored procedures and fixed tables:
Then, when you read from a database in a specific object, you can scroll through each of the properties and get the type of the form and simply add the corresponding type of the general form to the page:
foreach(Property p in Object.Properties) { switch(p.FormType) { case FormType.CheckBox: PageForm.AddField(new CheckboxFormField(p.Name, p.Value)); break; case FormType.Email: PageForm.AddField(new EmailFormField(p.Name, p.Value)); break; case FormType.etc: ... break; } }
Of course, I threw the PageForm object, as well as the CheckboxFormField and EmailFormField objects. The PageForm object can just be a placeholder, and CheckboxFormField and EmailFormField can be UserControls or ServerControls.
I would not recommend trying to control the placement. Just list each field one at a time vertically. In any case, this is becoming increasingly popular, even with static forms that can fully control the layout. Most registration forms, for example, follow this agreement.
Hope this helps. If I misunderstood your question or if you would like further explanations, let me know.