Please help with dynamic objects modeling Blazor/MVC
-
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.
-
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.
-
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.
Guillermo Perez wrote:
How to make this non-hard-coded?
If you mean that the complete list of properties aren't / can't be known "up front" when you're compiling your code, then you'll need something like an Entity–attribute–value model[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Guillermo Perez wrote:
How to make this non-hard-coded?
If you mean that the complete list of properties aren't / can't be known "up front" when you're compiling your code, then you'll need something like an Entity–attribute–value model[^].
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Thank you mr Richard, this is more a realistic approach to what I'm looking for, thank you again!