© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
37 replies
LazyGuard

❔ How to design this code ?

Hi folks, I am having some troubles coming up with a design for the following problem.
I have a Product object that have a several properties (e.g. category (a string), dangerous (a boolean), type (enum), length(int), height(int), weight(int) etc.)
There is a set of rule that allows to set the value of some properties based on conditions on other properties. For example : Set the
Type
Type
property to "Big" when
Length
Length
>2 and
Weight
Weight
>15. Another example : "Set the
Dangerous
Dangerous
to
true
true
when
Category
Category
==
fireworks
fireworks
.
Those rule must not be harcoded in the code, because our users want to have the possibility to add such rules on their own.
Does anyone have an idea on how to do this ? Some of my pain point are :
- How to model a rule in a nosql database ?
- How to apply it seamlessly on the Product objects etc.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ how to show design code
C#CC# / help
2y ago
✅ How to optimize this code?
C#CC# / help
16mo ago
✅ How to modernize this code ?
C#CC# / help
2y ago
How to test this code?
C#CC# / help
3y ago