Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Break one table into many or leave alone?
Message
De
05/11/2009 18:34:55
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01433360
Message ID:
01433491
Vues:
34
The ability to fill a business object from a stored procedure ( which in essence fills a datatable and then creates strongly typed properties from the currentview ) is built into Strataframe, so I is just FillmutlipleDataTables("dbo.Fill_lookup_manager") with the params indicating the BOs that will receive the data, in sequence


So the sproc looks something like
CREATE PROCEDURE [dbo].[Fill_lookup_manager]
AS 
    BEGIN



-- 1 Retrieve the code data result set
        SELECT  code.ckey,
                code.clockey,
                code.ccodetype,
                code.cdescription,
...
                code.[timestamp]
        FROM    code
        ORDER BY ccodetype  
        
-- 2 Retrieve the agent data result set
        SELECT  agent.ckey,
                agent.caddinskey,
                agent.clockey,
                agent.cfileas,
                agent.ccompany,
  ...
                agent.[timestamp]
        FROM    agent
        ORDER BY ccompany ;

-- 3 Retrieve the association data result set
        SELECT  association.ckey,
                association.clockey,
                association.ccode,
                association.cname,
  ...
                association.[timestamp]
        FROM    association
        ORDER BY cname ;

-- 4 Retrieve the broker data result set
        SELECT  broker.ckey,
                broker.clockey,
                broker.cinfotokey,
                broker.cfileas,
                broker.csalutation,
    ...
                broker.[timestamp],
                ( SELECT    cdescription
                  FROM      code
                  WHERE     broker.cinfotokey = code.ckey
                ) AS cinfoto
        FROM    broker
        ORDER BY ccompany ;
...
I have a lookup manager that creates has properties for each lookup bo and that fills them from the sproc on startup
            '-- use sproc to fill em all 
            Using cmd As New SqlCommand("dbo.fill_lookup_manager")
                cmd.CommandType = CommandType.StoredProcedure
                cmd.CommandText = "fill_lookup_manager"
                BusinessLayer.FillMultipleDataTables(cmd, _
                                                     _code, _agent, _association, _broker, _carrier, _
                                                     _ccagent, _ccarrier, _ccassociation, _cccdiscount, _ccchaggrat, _
                                                      _ccchazard, _ccchcomponent, _ccchdeductible, _ccchdiscount, _ccchexplvl, _
                                                     _ccchinccov, _ccchperil, _cccomponent, _cccoverage, _cccperil, _
                                                      _ccendfee, _ccendorsement, _ccendtodo, _ccfee, ccfinopt, _
                                                     _ccmga, _classtype, _codetype, _finopt, _location, _
                                                     _mga, _nextnumbers, _taxclass, _taxcoverage, _taxjuris)
            End Using
This is a framework method, of course, but well within the normal abiliites of ADO.


>>But that;s the point. In .net you pull the data and you populate the control - seperate steps. Get all the data in one trip, then populate the controls. ADO worlks differently from Fox. There is a lot of power in the disconnected nature of ADO data. You can return multiple cursors with a single sproc - one trip to the server - and then fill multiple datatables from that sproc from which you fill your controls., It is more efficient than 25 trips.
>>
>>One of the big myths that has lived in our community for too long is that Fox "handles data" better than .NET. Just isn't true. I handles it differently and there are strengths and weaknesses on both sides, but once you really get your head into the .NET way of doing things you'll find the advantages can be very great.
>>
>>I have one app that needs lookup data from 37 different lookup tables. All of that is pulled into business objects with strongly typed properties with one call to one sproc when the app starts up. After that I'm working with local cursors on instantiating every control on ever form that needs them - or just using them "under the hood" for calculation or validation.
>>
>
>Are you using Datasets? Also, is it one dataset with multiple datatables (for each lookup)? Or how exactly it's organized?


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform