ReadXml() public static method

public static ReadXml ( System.Guid workspaceID, ResourceType resourceType, string resourceID ) : string
workspaceID System.Guid
resourceType ResourceType
resourceID string
return string
Example #1
0
        // POST: Service/PluginServices/Methods
        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);
        }
Example #2
0
 // POST: Service/PluginServices/Test
 public RecordsetList Test(string args, Guid workspaceId, Guid dataListId)
 {
     try
     {
         var service = JsonConvert.DeserializeObject <PluginService>(args, new JsonSerializerSettings
         {
             TypeNameHandling = TypeNameHandling.Objects
         });
         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 the exception
             }
         }
         if (pluginSourceFromCatalog != null)
         {
             service.Source = pluginSourceFromCatalog;
         }
         return(FetchRecordset(service, true));
     }
     catch (Exception ex)
     {
         RaiseError(ex);
         return(new RecordsetList {
             new Recordset {
                 HasErrors = true, ErrorMessage = ex.Message
             }
         });
     }
 }
        // POST: Service/PluginSources/Get
        public PluginSource Get(string resourceId, Guid workspaceId, Guid dataListId)
        {
            var result = new PluginSource {
                ResourceID = Guid.Empty, ResourceType = ResourceType.PluginSource
            };

            try
            {
                var xmlStr = Resources.ReadXml(workspaceId, ResourceType.PluginSource, resourceId);
                if (!string.IsNullOrEmpty(xmlStr))
                {
                    var xml = XElement.Parse(xmlStr);
                    result = new PluginSource(xml);
                }
            }
            catch (Exception ex)
            {
                RaiseError(ex);
            }
            return(result);
        }