Model Dinámico

Asked

Viewed 39 times

1

Good morning!

I have the following problem, I need to create a model with fields whose values and types are defined in the result of using another model. I wonder if it is possible this, basically I make use of a model and wanted to use the results of the fields to create a new model.

        "field_name": "project_name",
        "field_type": "varchar2",

        Objectivo ir ao fild_type e atribuir um novo elemento de um Model com o tipo que la estiver declarado e dar lhe o nome do project name

            public field_type.value field_name.value { get; set; }

something of this kind... Thanks in advance!

  • One model will inherit from another model?!?

  • You can use Reflection to create and use variables dynamically. This is what you need?

  • Do you want to declare a method with a dynamic name or access one? If you want to access, you can use Reflection for this, if you want to declare, you will have a little more work, needing Codedom to compile a code and link in the current Assembly session.

  • So, I now have a JSON in the BD that has a structure and I have another one that is a JSON example, the supposed is to create something that validates JSON example for that, I was thinking about creating a model and if JSON obeys that perfect model, model that would be dynamically created with the values obtained in certain fields of the other Json Estrtutura

  • if it’s a json I think it’s easier to put in a dictionary that can take the key and the value, if it’s the idea of creating a model I think you can start by looking at expandoobjects

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.