473,657 Members | 2,555 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "inheritanc e". 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 1733
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**@discussio ns.microsoft.co m> wrote in message
news:17******** *************** ***********@mic rosoft.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 "inheritanc e". 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**@discussio ns.microsoft.co m> wrote in message
news:17******** *************** ***********@mic rosoft.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 "inheritanc e". 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**@discussio ns.microsoft.co m> wrote in message
news:17******** *************** ***********@mic rosoft.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 "inheritanc e". 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**@discussio ns.microsoft.co m> wrote in message
news:81******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co m> wrote in message
news:17******** *************** ***********@mic rosoft.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 "inheritanc e". 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**@discussio ns.microsoft.co m> wrote in message
news:81******** *************** ***********@mic rosoft.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**@discussio ns.microsoft.co m> wrote in message
news:17******** *************** ***********@mic rosoft.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 "inheritanc e". 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
17657
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 Create a Dynamic Crosstab Report PRODUCT :Microsoft Access PROD/VER:1.00 1.10 OPER/SYS:WINDOWS
1
4089
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 'Forms!frmDefaults!ProviderID' as a valid field name or expression, and debug takes me to line 60 below. Any Suggestions Would Be Truly Appreciated!
2
2411
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 web site to an ASP .NET Forms Authentication approach with SQL Server. I'm just getting comfortable with ASP .Net, but strong in Classic ASP.
8
2007
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 for the button. (This is done by the form itself, not by using VS.Net) (button and source code should be a record in database, these information should be retrieve from database when the form shows up) What I want is:
3
13739
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. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should always confirm a delete action. There is also a consensus that the best way to do this is a template...
7
2013
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 want to design a module that will create dynamic web forms that will convert paper based forms into webforms. help required ... thankx in advance -- Regards Adeel Alvi
0
2065
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab, System and Software Engineering Lab), ULB (deComp) and the Belgian Association for Dynamic Languages (BADL) are very pleased to invite you to a whole day of presentations about the programming languages Self, Smalltalk and Common Lisp by experts in...
3
5253
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 I get an error or I don't get anything back at all. I'm not sure how to make a dynamic array public (so to speak) so that I can call the information back between modules or forms. Can anyone help? Thanks.
0
1199
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 point where I am coding the forms that will take the user's input for the customer data. In a nutshell, I want to give the user the ability to save multiple contact persons, emails and phone numbers. OK. There can be many customers on this system...
0
8403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8316
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8610
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6174
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.