public static IDataService CreateProxy() { if (proxy == null) { //proxy = new Lambda.AutoService.DataService(); var type = DynaInvoke.GetType("DataService", "Lambda.AutoService.dll"); proxy = Activator.CreateInstance(type) as IDataService; ModelCore.MakeToken(proxy); ModelCore.Count++; } return(proxy); }
public static IDataService CreateProxy() { lock (syncRoot) { if (channelFactory != null && channelFactory.State == CommunicationState.Faulted) { channelFactory.Abort(); channelFactory = null; } if (channelFactory == null) { tcpBinding.MaxReceivedMessageSize = 100000000; channelFactory = new ChannelFactory <IDataService>(tcpBinding, endPoint); } if (proxy != null && ((IClientChannel)proxy).State == CommunicationState.Faulted) { ((IClientChannel)proxy).Abort(); proxy = null; } if (proxy == null) { try { proxy = channelFactory.CreateChannel(); ((IClientChannel)proxy).Open(); ModelCore.MakeToken(proxy); ModelCore.Count++; } catch (Exception ex) { ex.ToString(); proxy = null; } } return(proxy); } }
/// <summary> /// Static constructor /// </summary> static Presenter() { Model = new ModelCore(); }