Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Please help with dynamic objects modeling Blazor/MVC

Please help with dynamic objects modeling Blazor/MVC

Scheduled Pinned Locked Moved .NET (Core and Framework)
asp-nethelptutorialquestionarchitecture
4 Posts 3 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Guillermo Perez
    wrote on last edited by
    #1

    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.

    L Richard DeemingR 2 Replies Last reply
    0
    • G Guillermo Perez

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You are referring to Classes. In example 1 your base class is Automotive, and the derived class is MotorCycle. You could also have another derived class named Car, etc. See Classes | Microsoft Docs[^] for full details.

      1 Reply Last reply
      0
      • G Guillermo Perez

        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.

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #3

        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

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        G 1 Reply Last reply
        0
        • Richard DeemingR Richard Deeming

          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

          G Offline
          G Offline
          Guillermo Perez
          wrote on last edited by
          #4

          Thank you mr Richard, this is more a realistic approach to what I'm looking for, thank you again!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups