× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Walden H. Leverich wrote:
CustomerObject:
- has a Collection of Address objects
- has a Collection of Phone objects

Yup... :)

Customer c = Customer.GetCustomer(22);
List<Address> customerAddresses = c.GetAddresses();
Foreach(Address a in customerAddresses)
Console.WriteLine(a.Line1);

This would simply get customer 22 from the database for each of his
addresses, print address line one.

And how you expose the Collection is up to you, so if you still want
to have
"GetMailingAddress()" style methods you can.

GetMailingAddress would probably return a single address (the default,
or the one marked as mailing) given its name so you could do this too:

Order o = Order.GetOrder(12343);
Address shipAddress = o.ShipToAddress;
Customer c = o.Customer;
Address customerMailingAddress = c.MailingAddress;
if (shipAddress != customerMailingAddress)
//We're shipping to the non-default address
else
//We're shipping to the default address

-Walden


Walden, What do your Customer or Order objects look like from an individual attribute perspective? Do you generate a base businessObject for each table you need that handles all IO?

The standard approach is creating or generating a class like:

public class Customer {

protected String name;
protected String address;
protected String city;
protected String State;
protected String zip;
protected double balanceDue;

public String getName()
{
return name;
}
public String setName(String aname)
{
name = aname
}
// other setters and getters

public generateBilling()
{
if (getBalanceDue() > 0 )
System.out.println("Customer " + getName() + " must pay this amount: " + getBalanceDue;
}
}



This is how the majority of development approaches I see are done. Tools like hibernate and other persistence frameworks can help automate this but you are still forced to deal with a lot of labor intensive coding yourself because you have to code for each field to do things like validation, security, etc which leads to limited productivity.

-Paul HOlm













}




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.