private object GetADFObjectFromJson(JObject jsonObject, string objectType, bool applyConfiguration = true) { Type dynClass; MethodInfo dynMethod; object ret = null; if (applyConfiguration) { ApplyConfiguration(ref jsonObject); } try { dynClass = new Core.DataFactoryManagementClient().GetType(); dynMethod = dynClass.GetMethod("DeserializeInternal" + objectType + "Json", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); var internalObject = dynMethod.Invoke(this, new object[] { jsonObject.ToString() }); dynClass = Type.GetType(dynClass.AssemblyQualifiedName.Replace("Core.DataFactoryManagementClient", "Conversion." + objectType + "Converter")); ConstructorInfo constructor = dynClass.GetConstructor(Type.EmptyTypes); object classObject = constructor.Invoke(new object[] { }); dynMethod = dynClass.GetMethod("ToWrapperType", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); ret = dynMethod.Invoke(classObject, new object[] { internalObject }); } catch (TargetInvocationException tie) { throw tie.InnerException; } return(ret); }
public Pipeline ADFPipelineFromJson(JObject jsonObject) { Type dynClass; MethodInfo dynMethod; string objectType = "Pipeline"; MapConfigElements(ref jsonObject); MapSlices(ref jsonObject); dynClass = new Core.DataFactoryManagementClient().GetType(); dynMethod = dynClass.GetMethod("DeserializeInternal" + objectType + "Json", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static); CoreModels.Pipeline internalObject = (CoreModels.Pipeline)dynMethod.Invoke(this, new object[] { jsonObject.ToString() }); dynClass = Type.GetType(dynClass.AssemblyQualifiedName.Replace("Core.DataFactoryManagementClient", "Conversion." + objectType + "Converter")); ConstructorInfo constructor = dynClass.GetConstructor(Type.EmptyTypes); object classObject = constructor.Invoke(new object[] { }); dynMethod = dynClass.GetMethod("ToWrapperType", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); Pipeline ret = (Pipeline)dynMethod.Invoke(classObject, new object[] { internalObject }); return(ret); }