asp.net mvc - Duplication of business logic in queries -
in project working on, have debtcollectioncase
object contains invoices, payments, creditnotes
, etc... problem encounter number of queries rising time, , continue rise , have lot of repetition of calculations in queries. instance, calculation unpaidamount
or interest
. mess, , worse time.
the solution put calcuations in domain objects, in functions, can reused in every place, done need fetch whole aggregate in memory, means debtcollectioncase, invoices, payments, creditnotes
should fetched , call functions calculations. should ok single record, when need list of those, hundread of debtcollection cases invoices , payments. big amount of data fetched , affect performances.
so question of doing in memory calculations better reusability , maintance , putting bussines logic in queries, means better performance harder maintance , violating dry. have advice approach should use?
i found solution, called delegatedecompiler
. lets u use entity unmapped properties , functions in linq select , statements, means reuseable, , translated sql, dont need fetch entities in memory. here link if needs link delegatedecompiler.
Comments
Post a Comment