7

We are using the Tridion.TopologyManager.Client assembly in our custom C# application to interact with the Topology Manager items. When I look at the assembly (version 8.5.0.466), I don't see any methods that will dispose the TopologyManagerClient. The class doesn't implement the IDisposable interface.

enter image description here

So my questions are

  • Do I have to explicitly close the client so it can be garbage collected?
  • If so how do I properly dispose the TopologyManagerClient so it doesn't take up resources?
4

In general all objects having any interaction with unmanaged resources should be disposed. With the CoreServiceClient (CS client) it's obvious and easy to do (see Tridion 2013 SP1 Core service timeout with frequent requests), however with the TopologyManagerClient (TP client) it's not that straightforward. One difference is that the CS client is a "pure" WCF client which inherits from ClientBase which implements the IDisposable (see below),

public class SessionAwareCoreServiceClient : ClientBase<ISessionAwareCoreService>, ISessionAwareCoreService 
public abstract class ClientBase<TChannel> : ICommunicationObject, IDisposable where TChannel : class

while the TP client is an OData (and not WCF) client which does not implement IDisposable

public class TopologyManagerClient : Microsoft.OData.Client.DataServiceContext

Technically speaking, saying that OData has no connection with WCF is incorrect:

OData Service using WCF Service. OData is a standardized protocol for creating and consuming data APIs. OData builds on core protocols like HTTP and commonly accepted methodologies like REST

So, having all this in mind, the question of disposing the TP client and how to do it should be approached from that direction, ie. should I, and if yes, how should I dispose an OData client, but if IIRC, you needn't.

| improve this answer | |
  • Good answer, but the quote about OData and WCF is a bit confusing. Indeed, it is possible to create a OData Service using WCF Data Services, but note that the Topology Manager Sevice is not implemented using WCF either (bur using WebAPI). Regardless, this is separate from the client (which is largely auto-generated based on the Service metadata). – Rick Pannekoek Jan 25 '19 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.