DoenaSoft.AbstractionLayer.Web.Default 1.0.0

dotnet add package DoenaSoft.AbstractionLayer.Web.Default --version 1.0.0
                    
NuGet\Install-Package DoenaSoft.AbstractionLayer.Web.Default -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DoenaSoft.AbstractionLayer.Web.Default" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DoenaSoft.AbstractionLayer.Web.Default" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="DoenaSoft.AbstractionLayer.Web.Default" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DoenaSoft.AbstractionLayer.Web.Default --version 1.0.0
                    
#r "nuget: DoenaSoft.AbstractionLayer.Web.Default, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DoenaSoft.AbstractionLayer.Web.Default@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DoenaSoft.AbstractionLayer.Web.Default&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=DoenaSoft.AbstractionLayer.Web.Default&version=1.0.0
                    
Install as a Cake Tool

DoenaSoft.AbstractionLayer.Web.Default

Default System.Net-based implementations of the web and HTTP abstraction interfaces defined in DoenaSoft.AbstractionLayer.Web. This package provides production-ready network operations for .NET Standard 2.0, .NET Framework 4.7.2, and .NET 10.

Package Id: DoenaSoft.AbstractionLayer.Web.Default

Targets: netstandard2.0, net472, net10.0

Overview

This package contains the default implementations that wrap System.Net classes to implement the interfaces from DoenaSoft.AbstractionLayer.Web. Use this package in production code to perform actual web and HTTP operations.

Dependencies:

  • DoenaSoft.AbstractionLayer.Web - Contains the interface contracts

License: MIT

Implementations

This package provides concrete System.Net-based implementations and utilities:

Core Implementation

  • WebServices - Default implementation of IWebServices. Factory for creating web clients and requests.

Web Operation Implementations

  • WebClient - Wraps System.Net.WebClient for downloading data, strings, and files
  • WebRequest - Wraps System.Net.WebRequest for creating and configuring HTTP requests
  • WebResponse - Wraps System.Net.WebResponse for reading HTTP responses

Utility Classes

  • HttpGetQueryBuilder - Builds HTTP GET query strings with proper URL encoding. Handles special characters including:
    • Umlauts (ä, ö, ü) - percent-encoded
    • Ampersands (&) - encoded as %26
    • Spaces - encoded as %20
    • Plus signs (+) - encoded as %2B
    • All other special characters properly escaped

Usage

Basic Usage

Install both packages:

Install-Package DoenaSoft.AbstractionLayer.Web
Install-Package DoenaSoft.AbstractionLayer.Web.Default

Use the default implementations in production code:

using DoenaSoft.AbstractionLayer.WebServices;

// Create the default WebServices instance
var webServices = new WebServices();

// Download a string
using var client = webServices.CreateWebClient();
var html = client.DownloadString("https://example.com");

// Create a web request
var request = webServices.CreateWebRequest("https://api.example.com/data");
using var response = request.GetResponse();
var data = response.ReadToEnd();

Using HttpGetQueryBuilder

Build URL-encoded query strings with proper handling of special characters:

using DoenaSoft.AbstractionLayer.WebServices;

var queryBuilder = new HttpGetQueryBuilder();
queryBuilder.Add("name", "Müller & Sons");
queryBuilder.Add("city", "München");
queryBuilder.Add("search", "value with spaces");

var queryString = queryBuilder.ToString();
// Result: name=M%C3%BCller%20%26%20Sons&city=M%C3%BCnchen&search=value%20with%20spaces

var url = $"https://api.example.com/search?{queryString}";

// Parse an existing query string
var parsed = HttpGetQueryBuilder.ParseQueryString("name=test&value=123");
var name = parsed["name"]; // "test"

Dependency Injection

Inject IWebServices into your classes for testability:

public class ApiClient
{
    private readonly IWebServices _webServices;

    public ApiClient(IWebServices webServices)
    {
        _webServices = webServices;
    }

    public string FetchData(string endpoint, Dictionary<string, string> parameters)
    {
        var queryBuilder = new HttpGetQueryBuilder();
        foreach (var param in parameters)
        {
            queryBuilder.Add(param.Key, param.Value);
        }

        var url = $"{endpoint}?{queryBuilder}";
        using var client = _webServices.CreateWebClient();
        return client.DownloadString(url);
    }
}

// In production (e.g., Program.cs or Startup.cs)
services.AddSingleton<IWebServices, WebServices>();

// In unit tests
var fakeWebServices = new FakeWebServices();
var apiClient = new ApiClient(fakeWebServices);

Testing Benefits

  • Production: Use this package for real network operations
  • Unit Tests: Reference only DoenaSoft.AbstractionLayer.Web (contracts) and create test doubles
  • Easily switch between real and fake implementations through dependency injection
  • All implementations use the same interfaces, ensuring consistent behavior
  • Test network error handling without making actual HTTP calls

Package Architecture

  • DoenaSoft.AbstractionLayer.Web - Interface contracts (required)
  • DoenaSoft.AbstractionLayer.Web.Default (this package) - System.Net-based implementations

Notes

  • HttpGetQueryBuilder properly encodes all special characters using Uri.EscapeDataString
  • Supports proxy configuration for all web operations
  • Culture-aware request creation through CultureInfo parameter
  • Thread-safe implementations for concurrent web operations
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on DoenaSoft.AbstractionLayer.Web.Default:

Package Downloads
DoenaSoft.DVDProfiler.Helper

A utility library for DVD Profiler plugin development. Provides registry access, online version checking, standard UI dialogs (About Box, Help, Progress), profile photo utilities, and common helper functions for integrating with the DVD Profiler application by Invelos.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 111 3/28/2026