コード例 #1
0
        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);
        }
コード例 #2
0
 public override int GetHashCode()
 {
     if (User != null && QueryName != null)
     {
         return(User.GetHashCode() ^ QueryName.GetHashCode());
     }
     else
     {
         return(base.GetHashCode());
     }
 }
コード例 #3
0
 /// <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
         });
     }
 }
コード例 #4
0
ファイル: DNSProxy.cs プロジェクト: DFishSoft/DnsService
        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);
        }
コード例 #5
0
ファイル: Client.cs プロジェクト: ariugwu/sharpbox
        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()));
            }
        }
コード例 #6
0
 public Query(QueryName name, IList <Criterion> criteria)
 {
     _name     = name;
     _criteria = criteria;
 }
コード例 #7
0
ファイル: Query.cs プロジェクト: curiousTauseef/jamim
 private Query(QueryName queryName, List <Criterion> criteria, List <Query> subQuery)
 {
     this._criteria  = criteria;
     this._queryName = queryName;
     this._subQuery  = subQuery;
 }
コード例 #8
0
 public Query(QueryName name, IList<Criterion> criteria)
 {
     _name = name;
     _criteria = criteria;
 }
コード例 #9
0
ファイル: Query.cs プロジェクト: LutherW/Maer
 public Query(QueryName name, IList<Query> subQueries, IList<Criterion> criteria)
 {
     _name = name;
     _subQueries = subQueries;
     _criteria = criteria;
 }
コード例 #10
0
ファイル: Requests.cs プロジェクト: crazyants/framework-2
 public override string ToString() => QueryName.ToString();
コード例 #11
0
ファイル: Query.cs プロジェクト: NDChen/MyDemoCode
 public Query(QueryName queryName, IList<Criterion> criteria)
 {
     this._queryName = queryName;
     this._criteria = criteria;
 }
コード例 #12
0
 public Query(QueryName name, IList <Criterion> criteria)
 {
     this._name     = name;
     this._criteria = criteria;
 }