protected T CreateChannelFactoryInterface(string endpointName) { if (_hostAddress.Length > 0) { //Remoting Service return (T)Activator.GetObject(typeof(T), _hostAddress); } else { //WCF Service ChannelFactory serviceChannel = new ChannelFactory(endpointName); //create the channel from the proxy if (serviceChannel == null) { //TODO: throw custom exception throw new ApplicationException("The service channel could not be created."); } return serviceChannel.CreateChannel(); } } [EndpointName("Clueless.ServiceHost.Artifact.Service.PPAT.IGlossaryTermContract")] public Clueless.Contracts.PPAT.ArtifactContext.IGlossaryTermContract PPATGlossaryTerm { get { return base.CreateChannelFactoryInterface(getEndpointName("PPATGlossaryTerm")); } } [EndpointName("Clueless.ServiceHost.Entity.Service.PVP.IEntityLoginContract")] public Clueless.Contracts.PVP.EntityContext.IEntityLoginContract PVPEntityLogin { get { //examine debug host address if (base._hostAddress.Length > 0) { //Remoting Service - used for debugging return (Clueless.Contracts.PVP.EntityContext.IEntityLoginContract)Activator.GetObject (typeof(Clueless.Contracts.PVP.EntityContext.IEntityLoginContract), base._hostAddress); } else { //WCF Service ChannelFactory serviceChannel = new ChannelFactory (base.getEndpointName("PVPEntityLogin")); //create the channel from the proxy if (serviceChannel == null) { //throw exception - channel could nto be established throw new ServiceChannelException(string.Format( ServiceChannelException.MSG_NOTFOUND, "Entity.Service.PVP.IEntityLoginContract")); } return serviceChannel.CreateChannel(); } } }