Dev2.Runtime.ServiceModel.WebSources.Get C# (CSharp) Method

Get() public method

public Get ( string resourceId, System.Guid workspaceId, System.Guid dataListId ) : WebSource
resourceId string
workspaceId System.Guid
dataListId System.Guid
return Dev2.Runtime.ServiceModel.Data.WebSource
        public WebSource Get(string resourceId, Guid workspaceId, Guid dataListId)
        {
            var result = new WebSource();
            try
            {
                var xmlStr = ResourceCatalog.Instance.GetResourceContents(workspaceId, Guid.Parse(resourceId)).ToString();
                if(!string.IsNullOrEmpty(xmlStr))
                {
                    var xml = XElement.Parse(xmlStr);
                    result = new WebSource(xml);
                }
            }
            catch(Exception ex)
            {
                RaiseError(ex);
            }
            return result;
        }

Usage Example

Esempio n. 1
0
        public void WebSourcesGetWithValidArgsExpectedReturnsSource()
        {
            var expected = CreateWebSource();
            var saveArgs = expected.ToString();

            var workspaceID = Guid.NewGuid();
            var workspacePath = EnvironmentVariables.GetWorkspacePath(workspaceID);
            try
            {
                var handler = new WebSources();
                handler.Save(saveArgs, workspaceID, Guid.Empty);

                var actual = handler.Get(expected.ResourceID.ToString(), workspaceID, Guid.Empty);

                VerifySource(actual, expected);
            }
            finally
            {
                try
                {
                    if(Directory.Exists(workspacePath))
                    {
                        DirectoryHelper.CleanUp(workspacePath);
                    }
                }
                // ReSharper disable EmptyGeneralCatchClause
                catch(Exception)
                // ReSharper restore EmptyGeneralCatchClause
                {
                }
            }
        }
All Usage Examples Of Dev2.Runtime.ServiceModel.WebSources::Get