public T Fetch <T>(QueryName queryName, object[] args) { var action = this.QueryHub[queryName]; var result = action.DynamicInvoke(args); // Add the query name to the query stream this.QueryStream.Enqueue(queryName); return((T)result); }
public override int GetHashCode() { if (User != null && QueryName != null) { return(User.GetHashCode() ^ QueryName.GetHashCode()); } else { return(base.GetHashCode()); } }
/// <summary> /// Allows you to register a query by name and target /// </summary> /// <typeparam name="T">The entity to be returned</typeparam> /// <param name="queryName">The name of the query (i.e. - 'Get', 'GetXByZFromY', etc)</param> /// <param name="action">The target delegate that will return T</param> /// <param name="feedback"></param> public void Register <T>(QueryName queryName, Delegate action, Feedback feedback) { try { this.FeedbackHub.Add(queryName.Name, feedback); this.QueryHub.Add(queryName, action); // wireup the action associated with this command, and the event channel to broadcast to when this command is processed. } catch (Exception ex) { var msg = string.Format(ResponseMessage, "Query Registration failed with msg: " + ex.Message, action.Method.Name, typeof(T).Name); this.Broadcast(new Response { Entity = ex, Type = ex.GetType(), EventName = EventName.OnException, Message = msg }); } }
protected List <byte> addName() { List <byte> list = new List <byte>(); if (Point != 0) { list.AddRange(BitConverter.GetBytes(IPAddress.HostToNetworkOrder(Point))); } else { string[] a = QueryName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < a.Length; i++) { list.Add((byte)a[i].Length); for (int j = 0; j < a[i].Length; j++) { list.Add((byte)a[i][j]); } } list.Add(0); } return(list); }
public IList <T> Query(QueryName queryName, string query = null) { // Get the full QueryName queryName = _context.Dispatch.QueryHub.First(x => x.Key.Name == queryName.Name).Key; ODataQueryOptions <T> options = null; List <object> args = null; if (!string.IsNullOrEmpty(query)) { options = new ODataQueryOptions <T>(new ODataQueryContext(this._odataModelbuilder.GetEdmModel(), typeof(T)), new HttpRequestMessage(HttpMethod.Get, _dummyAbsoluteUri)); args.Add(options); } if (args == null) { return(_context.Dispatch.Fetch <IList <T> >(queryName, null)); } else { return(_context.Dispatch.Fetch <IList <T> >(queryName, args.ToArray())); } }
public Query(QueryName name, IList <Criterion> criteria) { _name = name; _criteria = criteria; }
private Query(QueryName queryName, List <Criterion> criteria, List <Query> subQuery) { this._criteria = criteria; this._queryName = queryName; this._subQuery = subQuery; }
public Query(QueryName name, IList<Criterion> criteria) { _name = name; _criteria = criteria; }
public Query(QueryName name, IList<Query> subQueries, IList<Criterion> criteria) { _name = name; _subQueries = subQueries; _criteria = criteria; }
public override string ToString() => QueryName.ToString();
public Query(QueryName queryName, IList<Criterion> criteria) { this._queryName = queryName; this._criteria = criteria; }
public Query(QueryName name, IList <Criterion> criteria) { this._name = name; this._criteria = criteria; }