I'm new to the whole .NET scene, and I'm still trying to figure this thing out.
One thing that seems to have a lot of attention is the Driven Design template. And I want to start flying in the .NET world and do it right, I dived trying to apply it to my project.
As I understand it, it’s bad practice to provide the domain object with access to persistence features, such as repositories, but then I really struggle to get around the problem of impatient loading when working with strongly connected graphs. Usually, this ends with the fact that there is practically no logic in the domain model and moves all of it to the service level, which performs calculations and fills the model’s objects with data or returns the result directly, for example, price = productService.CalculatePriceFor(product, user);instead price = product.Price(user), since the latter cannot be done without having to load the entire tree of product groups and matrixes of discounts at the first request of the object.
What is good practice here? Introduce product subclasses, where the information for obtaining the user price is calculated at boot time and has a different subclass when I do not need the user price?
source
share