How to use Rich Domain with bulk operations?

Since I am working on a relatively complex problem, I would like to use the Driven Design approach to solve the problem. The challenge is to calculate monthly invoices for customers. The current solution is implemented as a very long stored procedure that is difficult to maintain.

I would like to use an object oriented environment (maybe POCO and Entity Framework), but I'm concerned about performance. The current SP takes about 10 minutes to generate over 300,000 records using the specified operations. I think it will be very difficult to achieve with any ORM, as it will load the object one by one and send updates in the same way. (The previous version took 5 hours to access the records one by one.)

How to create a rich model for mass operations?

+4
source share
2 answers

I avoid using massive operations as much as possible when using a rich domain model.

Some party may be replaced by events. For example, I need a daily report on the number of orders.

Batch Solution:

The planning task, which starts at the end of the day, collects data from orders placed today.

Or use events

PlaceOrderService publishes an OrderPlacedEvent when a new order is placed. And eventHandler accepts the event and inserts it into T_ORDER_COUNT_ENTRY

|TODAY     |ORDER_ID|
|2012-04-01|123     |
|2012-04-01|124     |

We could use SQL count () to compute a report on the daily order schedule.

. , , 30 .

, , ().

, , OrderIsOverdue. , orderId, , .

, , , . , .

+3

, :

, ?

. , , , , - .

, , :

1 -

, , . , . , , / - , .

[aggregate roots]

: . .

2 -

​​, . , . , , . - - [SqlDatReader], SQL , .

3 -

[Unit of Work] . , , .

, , , - , .

+1

All Articles