some design advice

N

neilmcguigan

hi all

A. what is the preferred way to load an object, say a Customer (from a
db)

1. an instance member on the customer object

customer.Load(id)

2. a static member on the customer class?

Customer.Load(id)

3. an instance member on another class?

customerManager.Load(id)

4. a static member on another class?

CustomerManager.Load(id)

B. What is a good way to load a subset of customers?

CustomerList classFromAbove.GetCustomers(somefilter)

want to be able to specify a filter (with ANDs, ORs, etc) on zero or
more properties of a customer

provide a sort order list

provide a "page" size and "page" number

and get a total recordcount back for items matching the filter

without using sql in the filter, or sort order list :)


Thanks!

Neil
 
M

Michael Nemtsev

Hello (e-mail address removed),

First case:
1) Create CustomersManagement.Entity namespace that will contain Customer
class
2) Create CustomersManagement.Data namespace with CustomerData class creating
instances of Customer and returing ArrayList of them

Second case: use O/R mapping and such tools as NHibernate
A. what is the preferred way to load an object, say a Customer (from a
db)

1. an instance member on the customer object

customer.Load(id)

2. a static member on the customer class?

Customer.Load(id)

3. an instance member on another class?

customerManager.Load(id)

4. a static member on another class?

CustomerManager.Load(id)

B. What is a good way to load a subset of customers?

CustomerList classFromAbove.GetCustomers(somefilter)

want to be able to specify a filter (with ANDs, ORs, etc) on zero or
more properties of a customer

provide a sort order list

provide a "page" size and "page" number

and get a total recordcount back for items matching the filter

without using sql in the filter, or sort order list :)

Thanks!

Neil
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top