Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

Shopping cart and related entities should not have Dynamic Properties #313

Open
asvishnyakov opened this issue Jun 2, 2019 · 3 comments

Comments

@asvishnyakov
Copy link

The only purpose to use Dynamic Properties is to give managers ability to quickly add new property to object without requesting domain model extending. Because shopping cart isn't presented in UI, we should disallow to use Dynamic Properties in cart and related entities like LineItem or Shipment to prevent incorrect usage by developers.

@Woland2k
Copy link
Contributor

Woland2k commented Jun 2, 2019

Lets not remove dynamic properties from lineitem and cart, this is a powerful extensibility model. We should however improve loading of dynamic properties.

@asvishnyakov
Copy link
Author

asvishnyakov commented Jun 2, 2019

It's not only about performance. It's a bad practice to use DPs for any special purpose as they are very uncomfortable for coding.

Just compare:

Cart.DynamicProperties.FirstOrDefault(x => x.Name == "My property")?.Values.FirstOrDefault().Value

and

Cart.MyProperty

Of course, you may write helper, or do ony other stuff. But if adding property require any work from developers side - doesn't matter to put any logic here or add it to UI in special way - there is no one reason to use DPs instead of domain models extending. This possibility not less powerful.

@Woland2k
Copy link
Contributor

In liquid it should work like this: Cart.DynamicProperties.MyProperty. It still much easier to just add property through UI and then use it in the theme.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants