Architecture question
-
Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response
-
Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response
Here's my opinion... These kind of queries are what relational databases are all about. Doing a simple join in the query, instead of two database hits is WAY better. I don't think I've ever run across a case where I'd do two queries rather than a single join to get all of the data I need at the time.
-
Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response
Go for the one-shot. It is more effective... Give up about the entity-objects... they are useful when the colexity is very high, else use the database for what the databse is effective and good about... /Mattias
-
Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response