/// <summary> /// Lists the methods. /// </summary> /// <param name="assemblyLocation">The assembly location.</param> /// <param name="assemblyName">Name of the assembly.</param> /// <param name="fullName">The full name.</param> /// <returns></returns> public ServiceConstructorList ListConstructors(string assemblyLocation, string assemblyName, string fullName) { var serviceMethodList = new ServiceConstructorList(); if (_assemblyLoader.TryLoadAssembly(assemblyLocation, assemblyName, out Assembly assembly)) { var type = assembly.GetType(fullName); var constructors = type.GetConstructors(); constructors.ToList().ForEach(info => { var serviceConstructor = new ServiceConstructor(); var parameterInfos = info.GetParameters().ToList(); parameterInfos.ForEach(parameterInfo => { var constructorParameter = new ConstructorParameter { DefaultValue = parameterInfo.DefaultValue?.ToString() ?? string.Empty, EmptyToNull = false, IsRequired = !parameterInfo.IsOptional, Name = parameterInfo.Name, TypeName = parameterInfo.ParameterType.AssemblyQualifiedName, ShortTypeName = parameterInfo.ParameterType.FullName, }; var returnType = parameterInfo.ParameterType; BuildParameter(returnType, constructorParameter); serviceConstructor.Parameters.Add(constructorParameter); }); serviceMethodList.Add(serviceConstructor); }); } return(serviceMethodList); }
public void ToString_GivenIsNotNull_ShouldJsonFormat() { //---------------Set up test pack------------------- var constructorList = new ServiceConstructorList(); //---------------Assert Precondition---------------- Assert.IsNotNull(constructorList); //---------------Execute Test ---------------------- Assert.IsInstanceOfType(constructorList, typeof(List <ServiceConstructor>)); //---------------Test Result ----------------------- var s = constructorList.ToString(); var dev2JsonSerializer = new Dev2JsonSerializer(); var serialize = dev2JsonSerializer.Serialize(s); Assert.IsTrue(!string.IsNullOrEmpty(serialize)); }
public ServiceConstructorList Constructors(PluginService args, Guid workspaceId, Guid dataListId) { var result = new ServiceConstructorList(); try { // BUG 9500 - 2013.05.31 - TWR : changed to use PluginService as args var broker = new PluginBroker(); result = broker.GetConstructors(((PluginSource)args.Source).AssemblyLocation, ((PluginSource)args.Source).AssemblyName, args.Namespace); return(result); } catch (Exception ex) { RaiseError(ex); } return(result); }