private void CleanUpInternal() { LogOutOfService(); // TODO: Lookup best practices for closing WCF connections. _globalService.Close(); _globalService = null; }
private BetfairApi() { BasicHttpBinding httpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); httpBinding.MaxReceivedMessageSize = 10000000; _globalService = new GlobalService.BFGlobalServiceClient(httpBinding, new EndpointAddress("https://api.betfair.com/global/v3/BFGlobalService")); _exchangeService = new ExchangeService.BFExchangeServiceClient(httpBinding, new EndpointAddress("https://api.betfair.com/exchange/v5/BFExchangeService")); LogInToService(Username, Password, ProductId); Task maintainConnectionTask = Task.Factory.StartNew(MaintainConnection, TaskCreationOptions.LongRunning); }