Example #1
0
        public List <dynamic> Generate()
        {
            /* Assambly Process Start */
            DynamicType.GenerateAssemblyAndModule();

            List <Type> listType = new List <Type>();

            TypeBuilder tb = DynamicType.CreateType(DynamicType.modBuilder, ClassName);
            /* Assambly Process Finish */

            var dynamicObject     = JsonConvert.DeserializeObject <JObject>(JsonData);
            var listDynamicObject = dynamicObject.Properties();

            listType = DynamicType.CreateClassProperties("master", listDynamicObject, tb, listType);
            /* Propery create Finish */


            List <dynamic> listObj = new List <dynamic>();

            foreach (var itemType in listType)
            {
                listObj.Add(Activator.CreateInstance(itemType));
            }

            /* Propery set value Start */
            var obj = DynamicType.PropertySetValue(listType.LastOrDefault().Name, listDynamicObject, listType, listObj);

            /* Propery set value Finish */

            return(new List <dynamic>()
            {
                obj
            });
        }