Codemancer.Extensions.Wcf 1.0.0

dotnet add package Codemancer.Extensions.Wcf --version 1.0.0
NuGet\Install-Package Codemancer.Extensions.Wcf -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="Codemancer.Extensions.Wcf" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Codemancer.Extensions.Wcf --version 1.0.0
#r "nuget: Codemancer.Extensions.Wcf, 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.
// Install Codemancer.Extensions.Wcf as a Cake Addin
#addin nuget:?package=Codemancer.Extensions.Wcf&version=1.0.0

// Install Codemancer.Extensions.Wcf as a Cake Tool
#tool nuget:?package=Codemancer.Extensions.Wcf&version=1.0.0

Extensions.Wcf

Codemancer.Extensions.Wcf is a library that modernizes consuming SOAP based Web services by offering a similiar development experience to working with HttpClient.

If you are upgrading your client application but are still required to connect to some legacy SOAP service than this package is for you as I hope to show that it is still possible to teach an old dog new tricks.

Features

  • Fluent builder API to configure WCF DI services
  • Support for Polly policies

Example Usage

Given a WCF service

You can import service references via visual studio tooling for code generation or create service contract manually.

    [ServiceContract]
    public interface ISampleService
    {
        [OperationContract]
        string Example1(int param1, string param2, bool param3);

        [OperationContract]
        Task<string> Example1Async(int param1, string param2, bool param3);
    }

Configure WCF client

In your application Startup.cs file configure each WCF client in Startup.cs as follows:


    services.AddWcf<ISampleService>()
            .ConfigureServiceEndpoint(endpoint =>
            {
                endpoint.Address = new EndpointAddress("http://some.domain.com/endpoint.svc");
            });

Configure resilient strategies with Polly policies

    var retryPolicy = Policy<Message>.Handle<FaultException>()
                                     .RetryAsync(3);

    services.AddWcf<ISampleService>()
            .ConfigureServiceEndpoint(endpoint =>
            {
                endpoint.Address = new EndpointAddress("http://some.domain.com/endpoint.svc");
            })
            .AddPolicyHandler(retryPolicy);

References:

  • For more information about Polly policies see here policies
  • For HttpClient example see here
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 85 4/29/2024
1.0.0-beta.30 44 4/29/2024
0.0.0 368 10/11/2022
0.0.0-beta.22 94 10/11/2022
0.0.0-beta.16 102 10/10/2022