public ServiceMethod CreateInputsMethod(XElement action) { var result = new ServiceMethod { Name = action.AttributeSafe("SourceMethod"), Parameters = new List <MethodParameter>(), ExecuteAction = String.IsNullOrEmpty(action.AttributeSafe("ExecuteAction")) ? action.AttributeSafe("SourceMethod") : action.AttributeSafe("ExecuteAction") }; foreach (var input in action.Descendants("Input")) { if (!input.HasAttributes && input.IsEmpty) { continue; } var typeName = input.AttributeSafe("NativeType", true); Type tmpType = string.IsNullOrEmpty(typeName) ? typeof(object) : TypeExtensions.GetTypeFromSimpleName(typeName); XElement validator = input.Element("Validator"); // NOTE : Inlining causes debug issues, please avoid ;) result.Parameters.Add(new MethodParameter { Name = input.AttributeSafe("Name"), EmptyToNull = bool.TryParse(input.AttributeSafe("EmptyToNull"), out bool emptyToNull) && emptyToNull, IsRequired = validator != null && validator.AttributeSafe("Type").Equals("Required", StringComparison.InvariantCultureIgnoreCase), DefaultValue = input.AttributeSafe("DefaultValue"), TypeName = tmpType.FullName });
public PluginService() { ResourceID = Guid.Empty; ResourceType = Common.Interfaces.Data.ResourceType.PluginService; Source = new PluginSource(); Recordsets = new RecordsetList(); Method = new ServiceMethod(); }
public WebService() { ResourceID = Guid.Empty; ResourceType = "WebService"; Source = new WebSource(); Recordsets = new RecordsetList(); Method = new ServiceMethod(); }
public PluginService() { ResourceID = Guid.Empty; ResourceType = ResourceType.PluginService; Source = new PluginSource(); Recordsets = new RecordsetList(); Method = new ServiceMethod(); }
public ComPluginService() { ResourceID = Guid.Empty; ResourceType = "ComPluginService"; Source = new ComPluginSource(); Recordsets = new RecordsetList(); Method = new ServiceMethod(); }
public WebService() { ResourceID = Guid.Empty; ResourceType = ResourceType.WebService; Source = new WebSource(); Recordsets = new RecordsetList(); Method = new ServiceMethod(); }
public WebService() { ResourceID = Guid.Empty; ResourceType = Common.Interfaces.Data.ResourceType.WebService; Source = new WebSource(); Recordsets = new RecordsetList(); Method = new ServiceMethod(); }
public PluginService() { ResourceID = Guid.Empty; ResourceType = "PluginService"; Source = new PluginSource(); Recordsets = new RecordsetList(); MethodsToRun = new List <IDev2MethodInfo>(); Constructor = new ServiceConstructor(); Method = new ServiceMethod(); }
// BUG 9626 - 2013.06.11 - TWR : refactored static XElement CreateInputsXml(ServiceMethod method) { var inputs = new XElement("Inputs"); foreach (var parameter in method.Parameters) { var input = new XElement("Input", new XAttribute("Name", parameter.Name ?? string.Empty), new XAttribute("Source", parameter.Name ?? string.Empty), new XAttribute("EmptyToNull", parameter.EmptyToNull), new XAttribute("DefaultValue", parameter.DefaultValue ?? string.Empty), new XAttribute("NativeType", parameter.TypeName ?? string.Empty) ); if (parameter.IsRequired) { input.Add(new XElement("Validator", new XAttribute("Type", "Required"))); } inputs.Add(input); } return(inputs); }
public Guid ExecuteServiceMethod(Resource resource, ServiceMethod serviceMethod) { throw new NotImplementedException(); }
public IOutputDescription TestServiceMethod(Resource resource, ServiceMethod serviceMethod) { throw new NotImplementedException(); }
/// <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 ServiceMethodList ListMethods(string assemblyLocation, string assemblyName, string fullName) { Assembly assembly; var serviceMethodList = new ServiceMethodList(); if(TryLoadAssembly(assemblyLocation, assemblyName, out assembly)) { var type = assembly.GetType(fullName); var methodInfos = type.GetMethods(); methodInfos.ToList().ForEach(info => { var serviceMethod = new ServiceMethod { Name = info.Name }; var parameterInfos = info.GetParameters().ToList(); parameterInfos.ForEach(parameterInfo => serviceMethod.Parameters.Add( new MethodParameter { DefaultValue = parameterInfo.DefaultValue==null ? string.Empty : parameterInfo.DefaultValue.ToString(), EmptyToNull = false, IsRequired = true, Name = parameterInfo.Name, Type = parameterInfo.ParameterType })); serviceMethodList.Add(serviceMethod); }); } return serviceMethodList; }
// ReSharper disable InconsistentNaming public void DbService_ToXml_WhenRecordSetHasBlankFields_ExpectNotPartOfOutputDescription() // ReSharper restore InconsistentNaming { //------------Setup for test-------------------------- var dbService = new DbService(); var dbSource = new DbSource { ResourceName = "Source" }; var resourceId = Guid.NewGuid(); dbSource.ResourceID = resourceId; dbService.Source = dbSource; var serviceMethod = new ServiceMethod { Name = "Method" }; dbService.Method = serviceMethod; var recordset = new Recordset { Name = "SomeRecSet" }; var recordsetField = new RecordsetField { Alias = "SomeAlias", Name = "" }; recordset.Fields.Add(recordsetField); dbService.Recordset = recordset; // ReSharper disable InconsistentNaming const string expected = @"<Service ID=""00000000-0000-0000-0000-000000000000"" Name="""" ResourceType=""DbService"" IsValid=""false""> <Actions> <Action Name=""SomeRecSet"" Type=""InvokeStoredProc"" SourceID=""{0}"" SourceName=""Source"" ExecuteAction="""" SourceMethod=""Method""> <Inputs /> <Outputs /> <OutputDescription><![CDATA[<z:anyType xmlns:i=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:d1p1=""http://schemas.datacontract.org/2004/07/Unlimited.Framework.Converters.Graph.Ouput"" i:type=""d1p1:OutputDescription"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/""><d1p1:DataSourceShapes xmlns:d2p1=""http://schemas.microsoft.com/2003/10/Serialization/Arrays""><d2p1:anyType i:type=""d1p1:DataSourceShape""><d1p1:_x003C_Paths_x003E_k__BackingField /></d2p1:anyType></d1p1:DataSourceShapes><d1p1:Format>ShapedXML</d1p1:Format></z:anyType>]]></OutputDescription> </Action> </Actions> <AuthorRoles /> <Comment /> <Tags /> <HelpLink /> <UnitTestTargetWorkflowService /> <BizRule /> <WorkflowActivityDef /> <XamlDefinition /> <DataList /> <TypeOf>InvokeStoredProc</TypeOf> <DisplayName></DisplayName> <Category></Category> <AuthorRoles></AuthorRoles> <ErrorMessages /> </Service>"; // ReSharper restore InconsistentNaming //------------Execute Test--------------------------- var xElement = dbService.ToXml(); //------------Assert Results------------------------- Assert.AreEqual(string.Format(expected, resourceId), xElement.ToString()); }
public static PluginService CreatePluginService(ServiceMethod method) { var type = typeof(DummyClassForPluginTest); var source = CreatePluginSource(); var service = new PluginService { ResourceID = Guid.NewGuid(), ResourceName = "DummyPluginService", ResourceType = ResourceType.PluginService, ResourcePath = "Tests", Namespace = type.FullName, Method = method, Source = source }; return service; }