To marry consumer aggregates (such as SQL calculations) with "clean" model objects?

What is the best practice for embedding custom (usually mutable) data in entity model classes? At first, this may seem like bad practice, but it seems to be a fairly common scenario. In our recent web application, we have developed a suitable model, and in most cases we do a great job of loading model objects. But there are cases when we cannot afford to load the entire hierarchy of objects; we need to load, say, the results of a SQL COUNT pair or, perhaps, some additional information along with (or built-in) model objects. Basically, the terms and conditions:

  • This is a web application in which 99.9999999999% of all operations are read operations.

  • They do not need to process or execute complex business logic. We just need to quickly get the data in HTML.

  • In several cases with performance criticism, we need to load the results of SQL aggregates that do not match any model properties.

  • We need an extensible way to enter any new user data, if necessary.

How do you usually solve this problem without working too much on your ORM (for example, raw data from db)? I am sure this has been discussed many times, but I cannot find a good google request to find anything useful.

Change . Since later I realized that the question was not very well formed, I decided to reformulate it and start a new one .

+1
3

, , OO.

, - .

Me , : " , ?" " ?". , OO, 10 , .

SQL, , XML- , XSLT ( HTML) javascript.

+2
0

, , , , . - , .

"" , , "".

But, in addition, the domain model can provide methods that retrieve read-only results that are too complex to be easily saved back to the database. This includes your example of grouped generalized query results, and also includes combined sets of query results, expressions like columns, etc.

The domain model template offers a way to separate the design of an OO application from the design of a physical database.

0
source

All Articles