I'm working on an application where users can create classes programatically at runtime. They have a UI screen where they fill out meta data which gets turned into classes. Basically, the data the user enters is used to generate properties in the .cs file.
So, I need to be able to instantiate an object from the generated class file after the user is finished entering the meta data. Since the class file is new and is not part of the compiled code for the web app, how do I go about loading and instantiating the class?
I am able to generate a DLL programatically after the user is finished entering the meta data. the DLL contains the .cs file representing the meta data entered by the end user.
I've looked into creating an appDomain and loading the dll but that fails because the process can't find the DLL (even though I'm using a physical path for the newly created DLL). I've looked into plugIn architecture - MEF (Microsoft Extensibility Framework), MAF (Microsoft Addin Framework) but I'm a little confused on which to use.
What is the best approach to use?