REST Service Calls for .NET - 1.0

Extension ID

com.castsoftware.dotnet.service

What’s new?

See REST service call for .NET - 1.0 - Release Notes for more information.

Description

This extension provides support for some web services calls from C#.

Supported REST client libraries

Native
  • Windows.Web.Http.HttpClient
  • System.Net.Http.HttpClient
  • System.Net.HttpWebRequest
Third-party
  • Refit
  • RestSharp.RestClient
    • RestSharp.RestClient.Execute
    • RestSharp.RestClient.GetAsync
    • RestSharp.RestClient.PostAsync
    • ...
  • Flurl.Http

Function Point, Quality and Sizing support

This extension provides the following support:

  • Function Points (transactions): A green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
  • Quality and Sizing: A green tick indicates that CAST can measure size and that a minimum set of Quality Rules exist
Function Points
(transactions)
Quality and Sizing
(tick) (error)

CAST AIP compatibility

This extension is compatible with:

CAST AIP release Supported
8.3.x (tick)

Dependencies with other extensions

The REST Service Calls for .NET extension requires that ≥ 1.3.4-funcrel or ≥ 1.4.1-funcrel of the .NET Analyzer  is also installed and used in order to ensure the most complete set of results. This dependency is not automatically handled when downloading the REST Service Calls for .NET extension, therefore you must ensure that the .NET Analyzer is downloaded and installed before starting an analysis.

What results can you expect?

Features

This extension analyzes web service calls made from C# code through classic fluent APIs. For example with System.Net.Http.HttpClient:

using System;
using System.Net.Http;

class Main
{
    void main()
    {
        var httpClient = new HttpClient();
        
        HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get,"hello/world");
        
        httpClient.SendAsync(request);
    }
}

Refit

Refitexternal link provides the means to call web services through interfaces with attributes. Therefore, analyzing:

using System.Threading.Tasks;
using Refit;

public interface IGitHubApi
{
    [Get("/users/{user}")]
    Task<string> GetUser(string user);
}

will create:

Objects

The following objects are displayed in CAST Enlighten:

Icon Description

Dotnet Delete Resource Service

Dotnet Get Resource Service

Dotnet Post Resource Service

Dotnet Put Resource Service
Dotnet Patch Resource Service

Rules

None.

Limitations

  • When the code uses a custom URL builder, we cannot evaluate the URL.
  • Configuration files are not  taken into account