Modeling with Dynamic Properties and Form

Guillermo Perez 26 Reputation points
2022-01-29T00:21:17.507+00:00

Hello and thank you for any help you may provide. I have a problem that is in my head for the past week and that I can't resolve and I will appreciate any help in resolving it.

In my head I would like to classify objects by category and sub-category, and have the sub-category have object properties according to the subtype... for example

OBJECT : Motorcycle => have name like "Harley Davidson 500 Street", etc

Category : Automotive > Subcategory : Motorcycle > THEN subcategory has a set of sub-properties like: Engine, Brand, Color, Price,

OBJECT Handbag => have name like "Gucci Guapisima Wherever Edition", etc

Category : Clothing and Apparel > Subcategory : Brand Handbags > THEN subcategory has a set of sub-properties like: Material, Size, Color, Price,

Not the way I see it is... Most of object share the majority of this structure, like all objects have name, all of them belong to a category and a sub-category, now the problem comes on how to setup properties for each sub-category... for example both objects share the Color and Price but not the other properties. How to make this non-hard-coded? in other words, we know some of the properties are shared between objects, how can we do a model like this and then put this into a form?

I could do a dictionary but in the end, how do I validate them in the form?

Thanks for any help you could provide me.

Developer technologies | ASP.NET | ASP.NET Core
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Washington 921 Reputation points MVP
    2022-01-29T15:43:51.227+00:00

    This may help: Blazor Tree Creator with Checkboxes

    169516-image.png

    The NodeName and the IsSelected show how you can add properties to each element.
    What this doesn't cover is associating those properties to other elements.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.