Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple Instances of the Same BO
Message
From
22/06/2010 15:40:28
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
22/06/2010 15:33:26
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01469400
Message ID:
01470227
Views:
34
>>This is exactly where I thought you might have problems. The BindingSource is supposed to be set to a business object and in the mm binding it expects the name of the Business object and not the name of the Business object instance. In other words, "Client" and not "oOwner". Since you have instantiated the same business object multiple times with different names, I don't know what it takes to bind that.
>>
>>There are a number of ways to do this and it depends on what you need. It appears you are only retrieving a single entity. Do you plan to allow the user to edit those or just display them? Are you retrieving more than one policy at a time?
>>
>>If only one policy, then I would just retrieve those owners, payors, etc. as an entity object.
>>
>>protected Client oClient;
>>protected ClientEntity ownerEntity;
>>protected ClientEntity payorEntity;
>>protected DataSet dsClient;
>>
>>this.oClient = (Client)this.registerBizObj(new Client());
>>this.ownerEntity = this.oClient.GetEntityByPK(this.oPolicy.Entity.OwnerFK);
>>this.payorEntity = this.oClient.GetEntityByPK(this.oPolicy.Entity.PayorFK);
>>this.dsClient = this.oClient.GetClientDataSetByPK(tthis.oPolicy.Entity.ClientFK);
>>this.txtOwnerName.Text = this.ownerEntity.Name;
>>this.txtPayorName.Text = this.payorEntity.Name;
>>
>>Depending on your answers to those questions, these might be some ideas to get you going.
>>Tim
>
>Thanks Tim,
>
>that might work. Yes, only one policy is being retrieved/edited. At the moment I think I will only display the data in readonly form (and allow them to edit it in another form) for the Client, Owner and Payor, so the Entity suggestion might work for me. But I really would have liked to do the editing of the BOs all in one place/page.
>
>I'll try it out and let you know.
>
>Is this a shortcoming in MM.NET? It seems very counter-intuitive to me as I am used to creating multiple instances of BOs and binding to the tables, not the BO class. Or am I just not grokking how it should work in scenarios like this?

I don't know if I would call it a shortcoming, although I wish there was something a bit different at times.

You can retrieve multiple tables within the dataset and bind to the tables. But in this case, you are only retrieving a single row anyway. I would probably do it like I showed as it doesn't seem those values would be edited here anyway. Typically not anyway.
There could always be a button there for edit, if they wanted to edit information associated with the Person table.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform