ASP.NET MVC and DDD

Asked

Viewed 808 times

2

I am trying to use DDD and Fluent Api in a test application. I have the following question:

I have a product register (in this case ink), when including a new product I put dropdownlist s, to force the correct and standardized registration, ex: White RAL 9003 LI BR PO, these acronyms and the color comes from dropdownlist s, and I want to save in a field "description"because on the index page I will show only this description.

I thought to do so: put the description field as readonly and as it is selecting the dropdownlist items it will fill the description field, using Avascripts, but I think it will hurt the DDD rule.

Is it right to do so or is there another way better? If there is another way more correct, what would it be? Which layer would put this routine?

  • Please read this before: http://answall.com/questions/78716/howto extend pocos-do-entity-framework-encapsulando-as-regras-de-neg%C3%B3cio

  • So you have a paint registration and a color registration and will create a new product from the combination of these two registrations, and the new product will have a "description" attribute concatenating the name of the two selected items? The weird thing I see there is replicated information (redundancy). If redundancy is no problem and if for the Product entity what is worth is that a description has been informed; the fact that this description has been facilitated for the user is not a problem.

  • 3

    Now, if you have in the Product the "description" field just to facilitate the display of information that is obtained from other product attributes (ink and color), then it is wrong. You should take care of these display details when displaying instead of redundancy information in the entity. Something else: where DDD comes in?

  • Caffé, good night to you! So the problem is this, let’s take an example of White Smooth Shiny Polyester paint, I want to force a standardization because in the old register that has been registered only White Paint. And the rest of the information, I believe that by doing so I can force a standardized record.

1 answer

1


Following the DDD standard, business rules always stay in the Domain layer.

"Domain - represents the concepts, rules and business logic. The whole focus of DDD is on this layer. Our work, from now on, will be to refine and deeply understand that part." (DANIEL CUKIER)

Therefore you have to evaluate, this description rule is a business rule, if the user changes this description by Html and the application end up recording this information it will affect the system ?

I would do as follows, create a method in my Domain layer that receives the information needed to assemble the description. When saving the information your save method will recall the method to create the description. So you ensure that your product description will always have the same standard.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.