Re: Multilayer applications

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: SP (egatsecneserp(reverse)_at_hotmail.com)
Date: 07/24/04


Date: Sat, 24 Jul 2004 14:18:16 -0400


"Just D" <no@spam.please> wrote in message
news:eblMc.16619$Zr.11652@okepread01...

> Hm, if I need just to get some data and show it on the DataGrid then why
> should I use my own custom object instead of a DataSet, it's easier to
bind
> an existing object to the DataGrid and enjoy. Am I right or not? Or you
> parse all DataSets and create your own custom class then expose it? In all
> other cases it's more convenient to use my own classes to work with data,
I
> know that.

This forces you to make sure the actual data is present in the dataset. Your
business object is not constrained in needing to contain
the actual "display" data, e.g Your Employee object has a EmployeeName and
DepartmentName properties. But
internally the Employee object only knows the Department key and is really
calling DepartmentsCollection[key].DepartmentName to provide the
"display" data. Getting the same behavior from a dataset is not so easy. I
like the ability to make my business objects "self serving".

> > Keep the GUI simple. Try not to make a "Windows" app in your browser.
> > Avoid view
> > state and session state as much as possible. Use hidden variables or
>
> It's not always easy to go this way. Sometimes I use the same page to show
> something and to edit something. It's my boss requirement. That's why I
need
> the page status, just to switch between page modes and it works fine.

Any "sophisticated" control will need ViewState in order to provide the
events necessary to handle multiple edits etc.
But selecting an employee from a dropdown list of 1000 employees can be
handled with some javascript and a hidden field.

> > Yes. My personal favorite is to use code generation to create all the
> > database methods (using SQLXML and XSLT). You end up with methods like
>
> Do you always use the Stored Procedures and never an implemented SQL code?

Unless I need to provide custom querying then stored procedures cover all
the bases. A data mapper co-ordinates between the business
classes and the database layer. It is "add new, delete removed, update
dirty".

> I saw one solution where all SQL queries have been stored into external
XML
> file. I don't see that this approach is very good but it exists. From my
> point of view it's much better to use a business layer to work with
queries.
> The main reason why I don't like this way - I can't use these class
> libraries from Windows Application, because all these queries will be
shared
> as a simple text file. There is no security at all.

My method does not distribute the XML file. It uses this metadata to
generate a database class and business object abstract classes.
I change the XSLT around to suit the methods I want for the particular
project. Sometimes I pass the business object to the
stored procedure method and let it get the values it needs from the object
rather than populating a long list of
parameters.

SP



Relevant Pages

  • Re: typed datasets vs. business objects
    ... When I use a business object to populate a gridview, for example, I loop through a datareader, populating an array list with instances of a custom class in the middle tier, and then send the array list up to the presentation layer and bind the gridview to it. ...
    (microsoft.public.dotnet.general)
  • Re: typed datasets vs. business objects
    ... When I use a business object to populate a gridview, for example, I ... don't have to loop through anything. ... I have done lots and lots and lots of reading on them vs custom ... DAL objects that the in-house written database engine used. ...
    (microsoft.public.dotnet.general)
  • Re: ProxyAttribute.CreateProxy
    ... for other custom types that are not derived from ... create the RealProxy and transparent proxy for the certain class instance. ... Regarding on the "How do I get to maintain the server reference" question ... Transparent proxy and backend real business object. ...
    (microsoft.public.dotnet.distributed_apps)
  • Re: Passing Business Objects through nTier Web App
    ... I've read those benchmarks and it did give me some concern. ... If you bind a grid to your business object, ... Web services aren't great for passing custom types like that... ... > marshalling cost that is incurred everytime you create a new object. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Custom Vlookup Function
    ... in this instance you don't need to write a custom ... Instead you can use the INDIRECT function of Excel. ... payroll for each employee for each month. ... Function LookupPay(EmployeeNumber as string, MonthTab as string) ...
    (microsoft.public.excel.programming)