Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you specfiy Business Entity to use within the BO?
Message
De
08/04/2008 12:48:52
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
08/04/2008 12:44:03
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01308629
Message ID:
01309066
Vues:
15
Hi Matt,

>Hmm.. I'm OK with your DS and BO approach, at least until Kevin sets us straight otherwise. (According to his web site he's doing an online training class this week, so maybe that is why he has not chimed in yet, but I really hope he reads this entire thread)

Me too but with specific example on how to do it.

>
>I guess I was just thinking that when using MM (or any O/RM for that matter) that *EVERYTHING* to do with data *had* to be (or should be) based on a BO/Entity Model, or else you were just becoming an un-educated hacker if you fell back to using a DataSet and DataTable to do somwething. Maybe I was wrong?

I see nothing wrong with using a dataset where appropriate. I don't think as long as you still respect the Business Object, rules, and defaults that you are still in the good zone :-) And when the data is static like that (won't be updated) then no reason really not to.

>
>So, is it common to use a few DataSets and DataTables in your application after all, especially for these static, list-based data pickers controls? Or would that be missing some other higher level features that will hurt me later?

I don't really think so.

>
>
>Hey - I just posted another thread on a slightly different topic, becuase I don't want to mix it in this post..It has to do with "multi-table queries on normalized data to bring back a single cursor" would you read that and see if you have any advise about that.

I will look at it.
Tim

>
>
>>Hi Matt,
>>
>>You are getting close.
>>
>>>Maybe I'm getting there...I get having GetCustomerNameList() *AND* GetCustomerByNumber(int custNo) both as methods in the same BO.
>>>
>>>(Let me also point out that GetCustomerNameList() is design to return a list of *ONLY* customers that currently have an active job (it does this by calling GetEntityList on a stored proc))
>>>
>>>
>>>Therefore, is this a strategic approach:
>>>
>>>In my form, would I then create two separate objects, with each one being based on the Customer BO like this:
>>>
>>>//-- Declare Objects
>>> private Customer CustomerList; ( EntityList)
>>> private Customer CustomerDetails; (an Entity)
>>>
>>>//-- Instantiate
>>> this.CustomerList = (Customer)this.RegisterBizObj(new Customer());
>>> this.CustomerDetails = (Customer)this.RegisterBizObj(new Customer());
>>>
>>>//-- Populate
>>> this.CustomerList.GetCustomerNameList();
>>>
>>>
>>> //on the SelectionChanged() event of the Customer grid:
>>> this.CustomerDetails.GetCustomerByNumber(cust_no_from_grid);
>>>
>>>
>>
>>I would not really advocate initializing two instances of the BO this way. I tried to return an EntityList and then also an individual record and according to Kevin you can do this. The problem I had was when I returned the individual record, it stepped on the list. Here is what I did in a similar situation. And since your list is not what you update (static) than you could do this pretty easy also.
>>
>>
>>
>>private Customer oCustomer;
>>private DataSet dsCustomerList;
>>
>>// Register the biz obj with the form
>>this.oCustomer = (Customer)this.RegisterBizObj(new Customer());
>>// Get the customer list dataset and bind it to the grid
>>this.dsCustomerList = this.oCustomer.GetdsCustomerList();
>>if (this.dsCustomerList.Tables[0].Rows.Count > 0)
>>{
>>     this.grdCustomer.DataSource = dsCustomerList;
>>     this.grdCustomer.DataBind();
>>    // You might want to set the initial index of the grid and then call the GetCustomerByNumber
>>    this.grdCustomer.SelectedIndex = 0;
>>    this.GetSpecificCustomer(cust_no_from_grid);
>>}
>>
>>// when the index changes, call the
>>private void grdCustomer_SelectedIndexChanged(object sender, EventArgs e)
>>{
>>     this.GetSpecificCustomer(cust_no_from_grid);
>>}
>>
>>// Make this a seperate method in the form so you can call it from multiple places
>>private void GetSpecificCustomer(int custNo)
>>{
>>    this.oCustomer.GetCustomerByNumber(custNo);
>>}
>>
>>
>>
>>By just getting a dataset, you won't step on the entity when you retrieve it. I am sure Kevin (and I wish he would) show us how to do this using an entity list and another entity without stepping on each other. I couldn't do it, and this worked great for me anyway. And when the data is static, who cares.
>>
>>I hope that helps, but you are getting close.
>>Tim
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform