Dev2.Runtime.ServiceModel.PluginServices.Methods C# (CSharp) Method

Methods() public method

public Methods ( string args, System.Guid workspaceId, System.Guid dataListId ) : ServiceMethodList
args string
workspaceId System.Guid
dataListId System.Guid
return ServiceMethodList
        public ServiceMethodList Methods(string args, Guid workspaceId, Guid dataListId)
        {
            var result = new ServiceMethodList();
            try
            {
                // BUG 9500 - 2013.05.31 - TWR : changed to use PluginService as args 
                var service = JsonConvert.DeserializeObject<PluginService>(args);
                var pluginSourceFromCatalog = _resourceCatalog.GetResource<PluginSource>(workspaceId, service.Source.ResourceID);
                if (pluginSourceFromCatalog == null)
                {
                    try
                    {
                        var xmlStr = Resources.ReadXml(workspaceId, ResourceType.PluginSource, service.Source.ResourceID.ToString());
                        if (!string.IsNullOrEmpty(xmlStr))
                        {
                            var xml = XElement.Parse(xmlStr);
                            pluginSourceFromCatalog = new PluginSource(xml);
                        }
                    }
                    catch(Exception)
                    {
                        //ignore this
                    }
                }
                if (pluginSourceFromCatalog != null)
                {
                    service.Source = pluginSourceFromCatalog;
                }
                var broker = new PluginBroker();
                var pluginSource = (PluginSource)service.Source;
                if(pluginSource != null)
                {
                    result = broker.GetMethods(pluginSource.AssemblyLocation, pluginSource.AssemblyName, service.Namespace);
                }
                return result;
            }
            catch(Exception ex)
            {
                RaiseError(ex);
            }
            return result;
        }

Usage Example

        public void PluginServicesMethodsWithValidArgsExpectedReturnsList()
        {
            var service = CreatePluginService();
            var args = service.ToString();
            var workspaceID = Guid.NewGuid();

            EnvironmentVariables.GetWorkspacePath(workspaceID);

            var services = new PluginServices();
            var result = services.Methods(args, workspaceID, Guid.Empty);

            Assert.AreEqual(9, result.Count);
        }
All Usage Examples Of Dev2.Runtime.ServiceModel.PluginServices::Methods