Skip to main content
deleted 2 characters in body
Source Link
Robert Harvey
  • 200.1k
  • 55
  • 468
  • 679

I am seeing this example in the Microsoft documentation:

enter image description here

Here we can see how the order itemOrderItem has a reference to the ID of the product, it is the first option that sure people uses to think, me too.

But I was thinking about this and I was thinking, why isn't OrderItem a value object?

If I use the ID of the product, I have the problem that if after I accepted the order and the description of the product is changed, I will see the new description. So if I want to keep the description that it had when I accepted the order, I can't do in this way.

So I was thinking that perhaps in this case it would be better a value object product, that it will have three properties referecereference, description and provider. I don't need more for an order item. In this way, the information will be store in a columns of the order line table, and then I will can prevent to modify it if the order is accepted.

Perhaps the example is simply to try to be more clear, but really all the examples that I have seen about order and items are in this way, to use the ID of the product.

So in sumarysummary, what are the advantages to use the ID and what are the advantages of the value object?

Thanks.

I am seeing this example in the Microsoft documentation:

enter image description here

Here we can see how the order item has a reference to the ID of the product, it is the first option that sure people uses to think, me too.

But I was thinking about this and I was thinking, why isn't a value object?

If I use the ID of the product, I have the problem that if after I accepted the order and the description of the product is changed, I will see the new description. So if I want to keep the description that it had when I accepted the order, I can't do in this way.

So I was thinking that perhaps in this case it would be better a value object product, that it will have three properties referece, description and provider. I don't need more for an order item. In this way, the information will be store in a columns of the order line table, and then I will can prevent to modify it if the order is accepted.

Perhaps the example is simply to try to be more clear, but really all the examples that I have seen about order and items are in this way, to use the ID of the product.

So in sumary, what are the advantages to use the ID and what are the advantages of the value object?

Thanks.

I am seeing this example in the Microsoft documentation:

enter image description here

Here we can see how OrderItem has a reference to the ID of the product, it is the first option that sure people uses to think, me too.

But I was thinking about this and I was thinking, why isn't OrderItem a value object?

If I use the ID of the product, I have the problem that if after I accepted the order and the description of the product is changed, I will see the new description. So if I want to keep the description that it had when I accepted the order, I can't do in this way.

So I was thinking that perhaps in this case it would be better a value object product, that it will have three properties reference, description and provider. I don't need more for an order item. In this way, the information will be store in a columns of the order line table, and then I will can prevent to modify it if the order is accepted.

Perhaps the example is simply to try to be more clear, but really all the examples that I have seen about order and items are in this way, to use the ID of the product.

So in summary, what are the advantages to use the ID and what are the advantages of the value object?

edited title
Link

Why is the product of the order item is a reference to the ID of t hethe product and not a value object?

Source Link

Why the product of the order item is a reference to the ID of t he product and not a value object?

I am seeing this example in the Microsoft documentation:

enter image description here

Here we can see how the order item has a reference to the ID of the product, it is the first option that sure people uses to think, me too.

But I was thinking about this and I was thinking, why isn't a value object?

If I use the ID of the product, I have the problem that if after I accepted the order and the description of the product is changed, I will see the new description. So if I want to keep the description that it had when I accepted the order, I can't do in this way.

So I was thinking that perhaps in this case it would be better a value object product, that it will have three properties referece, description and provider. I don't need more for an order item. In this way, the information will be store in a columns of the order line table, and then I will can prevent to modify it if the order is accepted.

Perhaps the example is simply to try to be more clear, but really all the examples that I have seen about order and items are in this way, to use the ID of the product.

So in sumary, what are the advantages to use the ID and what are the advantages of the value object?

Thanks.