public T Invoke() { var p = DynamicProxy <T> .Get(); foreach (var m in typeof(T).GetMethods()) { p.On(m).Calls(mi => this.proxy.Invoke(mi.Method.Name, mi.Args)); } return(p.Instance); }
/// <summary> /// Returns a dynamic representation of the specified group. /// /// </summary> /// <param name="groupName">The name of the group</param><param name="exclude">A list of connection ids to exclude.</param> /// <returns> /// A dynamic representation of the specified group. /// </returns> public T Group(string groupName, params string[] exclude) { var p = DynamicProxy <T> .Get(); foreach (var m in typeof(T).GetMethods()) { p.On(m).Calls(mi => this.Call(this.context.Group(groupName, exclude), mi)); } return(p.Instance); }
/// <summary> /// Returns a dynamic representation of all clients in a group except the calling client. /// /// </summary> /// <param name="groupName">The name of the group</param> /// <returns> /// A dynamic representation of all clients in a group except the calling client. /// </returns> public T OthersInGroup(string groupName) { var p = DynamicProxy <T> .Get(); foreach (var m in typeof(T).GetMethods()) { p.On(m).Calls(mi => this.Call(this.context.OthersInGroup(groupName), mi)); } return(p.Instance); }
/// <summary> /// Returns a dynamic representation of all clients except the calling client ones specified. /// /// </summary> /// <param name="exclude">A list of connection ids to exclude.</param> /// <returns> /// A dynamic representation of all clients except the calling client ones specified. /// </returns> public T AllExcept(params string[] exclude) { var p = DynamicProxy <T> .Get(); foreach (var m in typeof(T).GetMethods()) { p.On(m).Calls(mi => this.Call(this.context.AllExcept(exclude), mi)); } return(p.Instance); }
/// <summary> /// Returns a dynamic representation of the connection with the specified connectionid. /// /// </summary> /// <param name="connectionId">The connection id</param> /// <returns> /// A dynamic representation of the specified client. /// </returns> public T Client(string connectionId) { var p = DynamicProxy <T> .Get(); foreach (var m in typeof(T).GetMethods()) { p.On(m).Calls(mi => this.Call(this.context.Client(connectionId), mi)); } return(p.Instance); }