Esempio n. 1
0
        /// <summary>
        /// Clones this request for the given lifecycle location.
        /// </summary>
        /// <param name="lifecycle">The lifecycle point at which the directive request should be pointed.</param>
        /// <param name="dataSource">The data source being passed to the field this directive is attached to, if any.</param>
        /// <returns>GraphDirectiveRequest.</returns>
        public IGraphDirectiveRequest ForLifeCycle(
            DirectiveLifeCycle lifecycle,
            GraphFieldDataSource dataSource)
        {
            var request = new GraphDirectiveRequest(
                this.Directive,
                this.DirectiveLocation,
                this.Origin,
                this.Items);

            request.Id         = this.Id;
            request.LifeCycle  = lifecycle;
            request.DataSource = dataSource;
            return(request);
        }
Esempio n. 2
0
 /// <summary>
 /// Attempts to find a declared graph method that can handle processing of the life cycle and location
 /// requested of the directive.
 /// </summary>
 /// <param name="lifeCycle">The life cycle.</param>
 /// <returns>IGraphMethod.</returns>
 public IGraphMethod FindMethod(DirectiveLifeCycle lifeCycle)
 {
     return(this.Methods.FindMethod(lifeCycle));
 }
Esempio n. 3
0
 /// <summary>
 /// Retrieves the method template mapped to the given lifecycle and location. Returns null if nothing is registered.
 /// </summary>
 /// <param name="lifeCycle">The life cycle hook.</param>
 /// <returns>IGraphMethod.</returns>
 public IGraphMethod FindMethod(DirectiveLifeCycle lifeCycle)
 {
     return(_templateMap.ContainsKey(lifeCycle) ? _templateMap[lifeCycle] : null);
 }