Home All Groups Group Topic Archive Search About

3-Tier Binding Problem ?????????

Author
13 Jan 2006 3:44 AM
Dave Johnson
In a 3-Tier application, once upon a while comes the need for binding
objects or usercontrols from other objects, example binding a
usercontrol in the Presentation layer from a Business Layer Object,

My problem:

I have a Dynamically Rendered WebUserControl that it needs some
properties that will control how this WebUserControl be Rendered. The
information needed are found in a business layer Object. What I thought
about is making both the WebUserControl and the Business Class share the
same Interface. So that I can bind easly the properties of the Business
Object to the Control. 

Is this kind of solution is possible ?? what is the smartest way to do
it ??

Please help of you are able to layout a proposed solution to this
problem or at least state some good guidelines it will be much
appreciated.

Best Regards,


Sharing makes All the Difference

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com

Author
16 Jan 2006 12:28 AM
Axel Dahmen
You are quite unclear in your description of your 3 tier architecture. In
fact, .NET shows a nifty 3-tier implementation by simply deriving the
presentation layer from the business layer. Perhaps you might be able to use
this kind of architecture for your purposes if there is a 1:1 relation
between the presentation and the business object.

HTH,
Axel Dahmen

--
Back to DLL hell: Which .NET do YOU have installed?

-----------------
Show quoteHide quote
"Dave Johnson" <esharpco***@gmail.com> schrieb im Newsbeitrag
news:eHgzqO$FGHA.608@TK2MSFTNGP14.phx.gbl...
> In a 3-Tier application, once upon a while comes the need for binding
> objects or usercontrols from other objects, example binding a
> usercontrol in the Presentation layer from a Business Layer Object,
>
> My problem:
>
> I have a Dynamically Rendered WebUserControl that it needs some
> properties that will control how this WebUserControl be Rendered. The
> information needed are found in a business layer Object. What I thought
> about is making both the WebUserControl and the Business Class share the
> same Interface. So that I can bind easly the properties of the Business
> Object to the Control.
>
>  Is this kind of solution is possible ?? what is the smartest way to do
> it ??
>
> Please help of you are able to layout a proposed solution to this
> problem or at least state some good guidelines it will be much
> appreciated.
>
> Best Regards,
>
>
> Sharing makes All the Difference
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
Author
16 Jan 2006 12:36 AM
Dave Johnson
the problem is in a cinema reservation system.i have a seat business
object and a seat webusercontrol. both of the objects have the same
properties i want to bind them together at runtime. or there is any
other equivalent way.

best reagrds.

Sharing makes All the Difference

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Author
16 Jan 2006 1:19 AM
Axel Dahmen
Using interfaces might be a feasible solution then. Still this won't keep
you from implementing all the aggregation functions to promote the business
class's public properties/member functions.

Multiple inheritance might have been helpful here. By deriving from both,
System.Web.UI.UserControl and a base business class object, you could have
been simply accessing the business class's public properties/member
functions when addressing the presentation object. I tend to strongly
believe that this feature is missing in C#.

HTH,
Axel Dahmen


--
Back to DLL hell: Which .NET version do YOU have installed?


---------------
Show quoteHide quote
"Dave Johnson" <esharpco***@gmail.com> schrieb im Newsbeitrag
news:OwBmfTjGGHA.3532@TK2MSFTNGP14.phx.gbl...
> the problem is in a cinema reservation system.i have a seat business
> object and a seat webusercontrol. both of the objects have the same
> properties i want to bind them together at runtime. or there is any
> other equivalent way.
>
> best reagrds.
>
> Sharing makes All the Difference
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com
Author
16 Jan 2006 1:31 AM
Dave Johnson
aggregation ?? would u give a code snippet to how implement it.
i am aware of the concept but still cannt be sure that i know how to
implement it. lets say the problem is an Order Class and a Booking
Class.

the Order consists from a number of bookings.

could u give a simple abstraction for how the code of the order class
would be??

Best Regards,

Sharing makes All the Difference

--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Author
22 Jan 2006 4:57 PM
Axel Dahmen
Sure.. Aggregation is simply a quite cumbersome mechanism to promote method
calls to member objects and to return their results.

Here's a small example of aggregation:

// this is the business class
class Bisnuz : IBisnuz
{
    public float VAT;
    public float Net;

    public int calcGrossPrice()
        {return Net*VAT;}

    // C# doesn't even provide for that:
    public Bisnuz CopyConstructor(Bisnuz b)
        {VAT = b.VAT;
        Net = b.Net;
        return this;}
}


// this is the presentation class
//   It already derives from Control so you cannot derive it from
//   your business class as well. You have to add your business
//   class as an internal member and need to aggregate its
//   functionality.
class Present : System.Web.IO.Control, IBisnuz
{
    private Biznuz    _myBiz;

    #region Aggregation area
        public int calcGrossPrice()
            {return _myBiz();}

        public Bisnuz CopyConstructor(Bisnuz b)
            {return _myBiz(b);}
    #endregion
}


Having multiple inheritance you wouldn't have to do this. You'd simply
write:


class Present : System.Web.IO.Control, Bisnuz
{
}


HTH,
www.sportbootcharter.com
Axel Dahmen








-----------
Show quoteHide quote
"Dave Johnson" <esharpco***@gmail.com> schrieb im Newsbeitrag
news:Oc7aMyjGGHA.3936@TK2MSFTNGP12.phx.gbl...
> aggregation ?? would u give a code snippet to how implement it.
> i am aware of the concept but still cannt be sure that i know how to
> implement it. lets say the problem is an Order Class and a Booking
> Class.
>
> the Order consists from a number of bookings.
>
> could u give a simple abstraction for how the code of the order class
> would be??
>
> Best Regards,
>
> Sharing makes All the Difference
>
> --
> Sent via .NET Newsgroups
> http://www.dotnetnewsgroups.com