mercredi 24 janvier 2018

Build Object definition at compile time from string

I'm working on building generic API's where we need to have class objects as configurable so that any changes doesnt require actual code deployment to servers.

for instance, I need class object as below:

Public class Person{
public string  Name{get;set;}
public string  Id{get;set;}
}

I wan to define this structure in Database in string and while application running i will read the above definition from DB and built it and create an instance of it and assign values to the object.

is this possible?? I have been reading about Reflector but what i understand is we can create an instance of existing class dynamically but I need definition itself to built at run time.

what we are trying to achieve: we are building an API where consumers can pass their complex data objects to our system and we perform some validation on their data objects using LINQ Lambda expression and DynamicInvoke for that I need to have c# type object.I'm trying to avoid our application deployment if consumer want to do changes in the input object.





Aucun commentaire:

Enregistrer un commentaire