× 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.



You're using custom classes and no caching. If you have the time to
hand-write
every business class, you can get pretty good performance.

Nope. Not handwriting every class at all. We have a common base class
from which we inherit called (oddly enough) BusinessObject. This class
handles all IO to the tables. All we do is create the class "shell" that
has the correct properties and any methods we want to add. Oh, and even
the shell is generated for us. A simple example would be:

[DatabaseTable("Customer")]
public class Customer : BusinessObject
{
[DatabaseField("Id", IsKey = true, ExcludeFromInsert = true)]
int _Id;
[DatabaseField("CustomerName", Length = 50)]
string _CustName;

public int ID
{
Get {return _id;}
}

Public string Name
{
Get {EnsureLoaded(); return _CustName;}
Set {SetField("_CustName", value)};
}
}


That's it. That's the entire "business object" that we have to write.
And like I said, it's actually generated for us from the metadata in the
db. Of course, if you want to add a business method like, say
GetOpenOrders() then you have to code that. But we are programmers,
eventually we have to code something. :-) But that code would be:

Public List<Order> GetOpenOrders
{
Order example = Order.NewOrder();
Example.CustomerID = this.ID;
Example.OrderStatus = OrderStatus.Open;
Return Order.GetByExample(example);
}

-Walden

--
Walden H Leverich III
Tech Software
(516) 627-3800 x3051
WaldenL@xxxxxxxxxxxxxxx
http://www.TechSoftInc.com

Quiquid latine dictum sit altum viditur.
(Whatever is said in Latin seems profound.)


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Joe Pluta
Sent: Wednesday, July 09, 2008 9:29 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Mapping SQL Result Sets to Browsers

Walden H. Leverich wrote:
I know these were aimed at Maurice, but...


Just to be clear: I dont' say business objects are bad. I fyou have
the4 time to do them right, they can work wonderfully. You're using
custom classes and no caching. If you have the time to hand-write every

business class, you can get pretty good performance.

In RPG, we could just create a service program for every record,
encapsulate any calculations, and get the same benefits. We usually
don't because we don't need the performance boost, and the time taken to

hand write the thousands of classes we would need is hard to justify to
management.

Joe

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.