473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Dynamic Forms -- OO Design dilemma

Good Morning All,

What we have is a dynamic business object that has varying numbers and types
of properties. What it models is a generic saleable product. Not all
products have the same properties. For instance, if you were selling
software you wouldn't have a color, if you were selling vases you wouldn't
have a file size. So, even though they are all generic products, they have
specialized properties. I know you're thinking "inheritance". But, we're
making something that needs to accomodate any number of possible product
types but not require a recompile. One solution needs to work for everyone.
Additionally, the form on which a user inputs these products needs to build
itself based on the properties of the product that they are inputting. So,
if they're inputting a furniture product, the form should prompt them to
enter height, width, weight, color, etc. Or, if they are inputting a car
product, the form should prompt them to enter properties specific to a car.
Of course, the admins of this system would be responsible for specifying
ahead of time what properties a given product must have.

So, the question is: How do you make a database driven varying property
object and also handle being able to generate a product input form, display
page, and data storage/retrieval of such?
Thanks in advance,
Nathan
Jun 1 '06 #1
5 1717
I discuss issues some that can come up with this in great detail here
http://forums.microsoft.com/MSDN/Sho...iteID=1&mode=1

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Nate" <Na**@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
Good Morning All,

What we have is a dynamic business object that has varying numbers and
types
of properties. What it models is a generic saleable product. Not all
products have the same properties. For instance, if you were selling
software you wouldn't have a color, if you were selling vases you wouldn't
have a file size. So, even though they are all generic products, they
have
specialized properties. I know you're thinking "inheritance". But, we're
making something that needs to accomodate any number of possible product
types but not require a recompile. One solution needs to work for
everyone.
Additionally, the form on which a user inputs these products needs to
build
itself based on the properties of the product that they are inputting.
So,
if they're inputting a furniture product, the form should prompt them to
enter height, width, weight, color, etc. Or, if they are inputting a car
product, the form should prompt them to enter properties specific to a
car.
Of course, the admins of this system would be responsible for specifying
ahead of time what properties a given product must have.

So, the question is: How do you make a database driven varying property
object and also handle being able to generate a product input form,
display
page, and data storage/retrieval of such?
Thanks in advance,
Nathan

Jun 1 '06 #2
I understand that much, and we have a similar architecture implemented. The
question is how do I now build the user interface (form) (in this case using
ASP.NET) based on all of the additional properties. I know I can add
dropdowns and textboxes dynamically, but how do I map these added controls to
the values of the Product object? And how to do it w/o mixing my user
interface, business logic, and database layer together (need loose coupling).

"Greg Young" wrote:
I discuss issues some that can come up with this in great detail here
http://forums.microsoft.com/MSDN/Sho...iteID=1&mode=1

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Nate" <Na**@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
Good Morning All,

What we have is a dynamic business object that has varying numbers and
types
of properties. What it models is a generic saleable product. Not all
products have the same properties. For instance, if you were selling
software you wouldn't have a color, if you were selling vases you wouldn't
have a file size. So, even though they are all generic products, they
have
specialized properties. I know you're thinking "inheritance". But, we're
making something that needs to accomodate any number of possible product
types but not require a recompile. One solution needs to work for
everyone.
Additionally, the form on which a user inputs these products needs to
build
itself based on the properties of the product that they are inputting.
So,
if they're inputting a furniture product, the form should prompt them to
enter height, width, weight, color, etc. Or, if they are inputting a car
product, the form should prompt them to enter properties specific to a
car.
Of course, the admins of this system would be responsible for specifying
ahead of time what properties a given product must have.

So, the question is: How do you make a database driven varying property
object and also handle being able to generate a product input form,
display
page, and data storage/retrieval of such?
Thanks in advance,
Nathan


Jun 1 '06 #3

First, a disclaimer, I did not follow the link that Greg Young provided.

But as far as dynamic linking, it can be done. I have a WinForm that
provides a generic lookup for searching for anything in the database.
It uses generics, so if you wanted to prompt the user for a city, you
could use SearchBox<City> sb = new SearchBox<City();

The SearchBox<> uses attrbutes on the City class to determine which
fields / properties are searchable (so, reflection) and then builds text
boxes and databinds them to an instance of City.

It sounds maybe more complicated than it really is.

The basic is this, use Activator to get an instance of the class. Use
reflection to determine which fields to display, and then use
databinding to bind the instance to the controls.

--Brian

Nate wrote:
I understand that much, and we have a similar architecture implemented. The
question is how do I now build the user interface (form) (in this case using
ASP.NET) based on all of the additional properties. I know I can add
dropdowns and textboxes dynamically, but how do I map these added controls to
the values of the Product object? And how to do it w/o mixing my user
interface, business logic, and database layer together (need loose coupling).

"Greg Young" wrote:
I discuss issues some that can come up with this in great detail here
http://forums.microsoft.com/MSDN/Sho...iteID=1&mode=1

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Nate" <Na**@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
Good Morning All,

What we have is a dynamic business object that has varying numbers and
types
of properties. What it models is a generic saleable product. Not all
products have the same properties. For instance, if you were selling
software you wouldn't have a color, if you were selling vases you wouldn't
have a file size. So, even though they are all generic products, they
have
specialized properties. I know you're thinking "inheritance". But, we're
making something that needs to accomodate any number of possible product
types but not require a recompile. One solution needs to work for
everyone.
Additionally, the form on which a user inputs these products needs to
build
itself based on the properties of the product that they are inputting.
So,
if they're inputting a furniture product, the form should prompt them to
enter height, width, weight, color, etc. Or, if they are inputting a car
product, the form should prompt them to enter properties specific to a
car.
Of course, the admins of this system would be responsible for specifying
ahead of time what properties a given product must have.

So, the question is: How do you make a database driven varying property
object and also handle being able to generate a product input form,
display
page, and data storage/retrieval of such?
Thanks in advance,
Nathan


Jun 1 '06 #4
Hi,
You can use reflection, I did something like this when I was learning .net ,
you generate the page based on the properties of the type. using Labels for
RO properties and asp.net controls for the Set properties. I remember I used
attributes to give a description to the property , like "Enter Phone
number" for a PhoneNumber property for example.
The tricky part was detecting when a property was of a enum type and using a
dropdown accordingly.

--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Nate" <Na**@discussions.microsoft.com> wrote in message
news:81**********************************@microsof t.com...
I understand that much, and we have a similar architecture implemented.
The
question is how do I now build the user interface (form) (in this case
using
ASP.NET) based on all of the additional properties. I know I can add
dropdowns and textboxes dynamically, but how do I map these added controls
to
the values of the Product object? And how to do it w/o mixing my user
interface, business logic, and database layer together (need loose
coupling).

"Greg Young" wrote:
I discuss issues some that can come up with this in great detail here
http://forums.microsoft.com/MSDN/Sho...iteID=1&mode=1

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Nate" <Na**@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
> Good Morning All,
>
> What we have is a dynamic business object that has varying numbers and
> types
> of properties. What it models is a generic saleable product. Not all
> products have the same properties. For instance, if you were selling
> software you wouldn't have a color, if you were selling vases you
> wouldn't
> have a file size. So, even though they are all generic products, they
> have
> specialized properties. I know you're thinking "inheritance". But,
> we're
> making something that needs to accomodate any number of possible
> product
> types but not require a recompile. One solution needs to work for
> everyone.
> Additionally, the form on which a user inputs these products needs to
> build
> itself based on the properties of the product that they are inputting.
> So,
> if they're inputting a furniture product, the form should prompt them
> to
> enter height, width, weight, color, etc. Or, if they are inputting a
> car
> product, the form should prompt them to enter properties specific to a
> car.
> Of course, the admins of this system would be responsible for
> specifying
> ahead of time what properties a given product must have.
>
> So, the question is: How do you make a database driven varying
> property
> object and also handle being able to generate a product input form,
> display
> page, and data storage/retrieval of such?
>
>
> Thanks in advance,
> Nathan


Jun 1 '06 #5
It depends on how exactly you implemented your lower layers .. did you use
typed objects or did you use a property bag to return your data? I can tell
you now that if you use a property bag, the suggestions of going through
reflections will be one step above useless for you. How did you implement
type metadata for your user added columns (i.e. typing). Do you want
additional behaviors able to be added to the front end (such as supporting a
phone number on text box?)

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Nate" <Na**@discussions.microsoft.com> wrote in message
news:81**********************************@microsof t.com...
I understand that much, and we have a similar architecture implemented.
The
question is how do I now build the user interface (form) (in this case
using
ASP.NET) based on all of the additional properties. I know I can add
dropdowns and textboxes dynamically, but how do I map these added controls
to
the values of the Product object? And how to do it w/o mixing my user
interface, business logic, and database layer together (need loose
coupling).

"Greg Young" wrote:
I discuss issues some that can come up with this in great detail here
http://forums.microsoft.com/MSDN/Sho...iteID=1&mode=1

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"Nate" <Na**@discussions.microsoft.com> wrote in message
news:17**********************************@microsof t.com...
> Good Morning All,
>
> What we have is a dynamic business object that has varying numbers and
> types
> of properties. What it models is a generic saleable product. Not all
> products have the same properties. For instance, if you were selling
> software you wouldn't have a color, if you were selling vases you
> wouldn't
> have a file size. So, even though they are all generic products, they
> have
> specialized properties. I know you're thinking "inheritance". But,
> we're
> making something that needs to accomodate any number of possible
> product
> types but not require a recompile. One solution needs to work for
> everyone.
> Additionally, the form on which a user inputs these products needs to
> build
> itself based on the properties of the product that they are inputting.
> So,
> if they're inputting a furniture product, the form should prompt them
> to
> enter height, width, weight, color, etc. Or, if they are inputting a
> car
> product, the form should prompt them to enter properties specific to a
> car.
> Of course, the admins of this system would be responsible for
> specifying
> ahead of time what properties a given product must have.
>
> So, the question is: How do you make a database driven varying
> property
> object and also handle being able to generate a product input form,
> display
> page, and data storage/retrieval of such?
>
>
> Thanks in advance,
> Nathan


Jun 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: mtech1 | last post by:
Access 2002 I am trying to create a dynamic crosstab report that parameters come from 3 different forms. I get runtime error 3070 - The Microsoft Jet database engine does not recognize...
2
by: Joe Rigley | last post by:
Help Please! I've been tasked with converting a portion of the corporate web site that currently utilizes local user accounts and NTFS via Basic Authentication to access certain files on the...
8
by: George Meng | last post by:
I got a tough question: The backgroud for this question is: I want to design an application works like a engine. After release, we can still customize a form by adding a button, and source code...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
7
by: AdeelAlvi | last post by:
iam working on a project called service desk that automates the departmental services online .one major component i have to create is that to convert paper based forms into dynamic webforms . i...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
3
by: Troy | last post by:
I have a dilemma where I am creating a dynamic two dimensional array and filling it with information from a .csv file. Unfortunately, later when I try to call that information back from the array...
0
by: fjm | last post by:
I am having a bit of a problem getting my head around how to handle a design issue and hope that someone can offer some assistance. I am making a front end to a mysql database in PHP. I am at the...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.