Should I generate a complex object in the database or at the data access level?

I am working on an application for one of our departments that contains medical data. It interacts with the third-party system that we have here.

The object itself (the claim) is not terribly complex, but due to the nature of the data and the organization of the database, obtaining claim data is very difficult. I cannot just join all the tables and get the data. I need to make a “basic” request in order to get the basics of the claim, and then gather together additional data about the claim based on various issues.

It would be better when working with this data:

  • Generate an object in a stored procedure where all relevant data is available, and iterate through a table variable (using SQL Server 2005) to collect all the additional information.

  • Generate an object at the data access level, where I have slightly more powerful data manipulations at my disposal, and make a bunch of quick and easy calls to get the search data.

  • Use the OR / M tool and match all difficult situations to create an object.

  • Something else.

EDIT: just to clarify some of the problems listed below. Complexity is not really a problem for a business. If the claim is a code of type “UB”, then I need to get some additional data from table X. If there is a code like “HCFA” in the claim, then I need to get some data from table Y These are those things. Hope this helps.

+3
source share
7 answers

Another vote for stored procedures in this case.

What you are trying to model is a very specific piece of business logic (“what is a requirement”) that should be consistent in any application that deals with the concept of a claim.

, ; , , , , .

, -. DRY .

+1

. SELECT , , . . SELECT , . , . , . .

+1

/- . ORM/ , , , . , , , , .

+1

- , 1. , , , , ORM, 3 , , . , , , , , .

0

, (, ) .

, - (), -.

*.

, , , , , - -. , .

** , , , , , ... - . *

0

. - . , @hoffmandirt, .

0

, m'kay?

, .

.NET, ORM, Linq.

, - .

, , , . . , .

0

Source: https://habr.com/ru/post/1716608/


All Articles