Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple tables in BizObj?
Message
 
To
06/04/2009 16:01:41
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01392599
Message ID:
01394677
Views:
46
Sam,
The way I most often handle the save with multiple tables is using the Save method of the business form. For example, you may want to create a custom save button. From it's click method, you would enter: this.Save(bizobject, tablename); As Tim pointed out, there are lots of other ways to handle it as well, but that's what I have found most useful for my basic data entry requirements.


>Thanks again. At this point in time I am not working on a specific application. I am just trying to learn about using multiple tables in a single business object. The DevGuide mentions this posibility several times but does not give any specific examples. I appreciate your insight.
>
>Sam
>
>>You would have to do a little on your own, but it would be pretty easy. The business objects SaveDataSet() method for instance has 10 overloads so there is lots of flexibility. You don't have to use a standard save button, but you could just override the behavior to call the save methods on the business object that you need. Are you working on a project where you need this? I could throw something together to see what the best approach would be.
>>
>>>Thanks Tim,
>>>
>>>If you have multiple backend tables in a single business object as you suggest, how do you save changes to all the related tables in a single transaction? The standard Mere Mortals Save button causes the primary table in the business object to be saved, so at what point do you call the save methods for the other tables?
>>>
>>>Sam>
>>>>Hi Sam,
>>>>
>>>>I also use similar methods to do this as Linda stated. When I have a need for data that looks similar or exactly the same, I will often put that data in the same table and then just add a column to distinguish it. For instance I have a table in an application called DisplayItems which contains both news and events. The columns I wanted were the same so I just put both types of data in the same table and added a column called Type (being either News or Event). I have displayed both News and Events on the same web page but in different grids and call the data seperatly as Linda stated.
>>>>
>>>>To your question about multiple back end tables for the same business object. I have my own theory about this and may be all wet but to me a business object should relate to a real world Entity (not the individual row entity). So if I have a real world Entity which data normalization suggests should be made up of two different tables with a one to one relationship. Why shouldn't these be part of the same business object? My theory is they could be. To that end, the MM framework is not geared to this, but has the functionality to do it. When I say not geared to it I mean the Business Layer Generator for instance creates a business object for a given table. Additionally there are table name properties and such that are a bit on a one to one basis. This does not prevent one from creating this situation and if you are using views or stored procedures, then you have it mostly whipped anyway. So the idea would be a business object in my opinion should relate to a real world business entity regardless of the number of tables.
>>>>Tim
>>>>
>>>>>Questions: Could multiple DataSets retrieved from the same backend table all be used to update the table? If so, how would you call the Save method etc. Your example uses only 1 backend table, but I wonder if there is a real world need for using multiple backend tables in 1 business object?
>>>>>
>>>>>I am struggling to get the big picture of the Mere Mortals framework. Any help is appreciated.
>>>>>
>>>>>Sam
Linda Harmes
HiBit Technologies, Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform