a·gen·tic a·gil·i·ty

Custom WCF Proxy

TL;DR; Explains how to create custom WCF proxies in .NET to avoid redundant class generation and object conversion when consuming Windows Communication Foundation services.

Published on
1 minute read
Image
https://nkdagility.com/resources/hfv2zp8Q-i4
Subscribe

The think that always annoys me with web services is that when you connect to it and generate the proxy it always generates proxies for all of the extra classes and interfaces as well, even when you have them available. This means that you always have to write convertors or adapters to convert one object type to another even though they are the same object (only core class and proxy of that class).

I decided to solve the problem by creating custom proxies for my Windows Communication Foundation services. What you need to do is add a reference to your DataContract and ServceContract assemblies and do the following:

Friend Class SubscriptionsClient
      Inherits System.ServiceModel.DuplexClientBase(Of Services.Contracts.ISubscriptions)
      Implements Services.Contracts.ISubscriptions

End Class

This way you have no need of a convertors or adapters between object types. Obviously this only works for .NET to .NET implementations of servers, you Java guys are still on your own, but it a usefully tool to add to your arsenal.

Technorati Tags: .NET   SOA   WCF

Subscribe

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Hubtel Ghana Logo

Hubtel Ghana

Kongsberg Maritime Logo

Kongsberg Maritime

Alignment Healthcare Logo

Alignment Healthcare

Healthgrades Logo

Healthgrades

Lean SA Logo

Lean SA

NIT A/S

Cognizant Microsoft Business Group (MBG) Logo

Cognizant Microsoft Business Group (MBG)

Brandes Investment Partners L.P. Logo

Brandes Investment Partners L.P.

Trayport Logo

Trayport

Boxit Document Solutions Logo

Boxit Document Solutions

SuperControl Logo

SuperControl

Jack Links Logo

Jack Links

DFDS Logo

DFDS

Sage Logo

Sage

Big Data for Humans Logo

Big Data for Humans

Capita Secure Information Solutions Ltd Logo

Capita Secure Information Solutions Ltd

Illumina Logo

Illumina

Xceptor - Process and Data Automation Logo

Xceptor - Process and Data Automation

Royal Air Force Logo

Royal Air Force

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

Ghana Police Service Logo

Ghana Police Service

Washington Department of Enterprise Services Logo

Washington Department of Enterprise Services

Nottingham County Council Logo

Nottingham County Council

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

Illumina Logo

Illumina

Xceptor - Process and Data Automation Logo

Xceptor - Process and Data Automation

Deliotte Logo

Deliotte

Higher Education Statistics Agency Logo

Higher Education Statistics Agency

Epic Games Logo

Epic Games

Trayport Logo

Trayport