private UserServiceFactory(string address, ServiceInfo serviceInfo, IUserServiceCallback userServiceCallback) { this.binding = CremaHost.CreateBinding(serviceInfo); this.endPointAddress = new EndpointAddress($"net.tcp://{address}:{serviceInfo.Port}/UserService"); this.instanceContext = new InstanceContext(userServiceCallback ?? (this)); if (Environment.OSVersion.Platform != PlatformID.Unix) { this.instanceContext.SynchronizationContext = SynchronizationContext.Current; } }
public static UserServiceClient CreateServiceClient(string address, ServiceInfo serviceInfo, IUserServiceCallback userServiceCallback) { var factory = new UserServiceFactory(address, serviceInfo, userServiceCallback); return(new UserServiceClient(factory.instanceContext, factory.binding, factory.endPointAddress)); }
public BaseViewModel() { _userServiceCallback = this; usersSite = new InstanceContext(_userServiceCallback); UserServiceClient = new UserServiceClient(usersSite); }