Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Instantiating and using two instances of the same BO
Message
 
To
15/07/2009 15:13:07
Tegron Tegron
Platinum Technologies
Ohio, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01412544
Message ID:
01412552
Views:
45
What I have been doing when I have this sort of need is to create a 2nd table within the existing business object. You create just one business object but have two separate calls. You can modify your method in the business object to accept a tablename passed in as a parameter. Use the FillDataSet command with the override that includes a parameter for tablename. Using your example, you would have one business object, IRequests. One table would use the default table name (IRequests) and the other would have the tablename MCARequests. When you bind the data to the grids, the bindingsource for both grids would be IRequests but the BindingSourceMember would be the tablename.

I hope this helps.

>Is there a way to instantiate a business object twice and use it with different values? I would appreciate any recommendations somone can offer.
>
>I have two tabs on a webform that contain two different grid items. I have created two different form-level variables and I retrieve data into these two business objects:
>
>e.g. this.IRequests & MCARequests
>
>The problem is I can only bind to one.
>
>They're instantiate like the following:
>
> this.IRequest = (Request)this.RegisterBizObj(new Request());
> this.MCARequest = (Request)this.RegisterBizObj(new Request());
>
>I fill them like this:
>
> this.IRequest.GetRequestsByGuardianID(this.guardianID, 1);
> this.MCARequest.GetRequestsByGuardianID(this.guardianID, 2);
>
>When I bind it only shows one business object available. Is there a way to display two different business objects that have different names, so tha tI can bind each grid to them. Currently they are both displaying the same data in both grids. If I can instantiate the same business object with a different name and register the two names with the form, I think that this would solve my problem.
Linda Harmes
HiBit Technologies, Inc.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform