コード例 #1
0
        /// <summary>
        /// Creates a copy of the current object
        /// </summary>
        /// <returns>The field clone</returns>
        public MergedField Clone()
        {
            var apiProvider = this.providers.First();
            var field       = this.OriginalFields[apiProvider.Description.ApiName];

            var mergedField = new MergedField(
                this.FieldName,
                this.Type,
                apiProvider,
                field,
                this.Flags,
                this.Arguments,
                this.Description);

            mergedField.Resolver = this.Resolver;

            foreach (var provider in this.providers.Skip(1))
            {
                mergedField.AddProvider(provider, this.OriginalFields[provider.Description.ApiName]);
            }

            return(mergedField);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MergedRoot"/> class.
        /// </summary>
        /// <param name="originalTypeName">
        /// The original type name.
        /// </param>
        /// <param name="providers">
        /// The providers.
        /// </param>
        /// <param name="root">
        /// The root.
        /// </param>
        public MergedRoot(string originalTypeName, List <ApiProvider> providers, MergedApiRoot root)
            : base(originalTypeName)
        {
            if (providers == null || providers.Count == 0)
            {
                return;
            }

            this.searcher = root.NodeSearher;
            var apiField = new MergedField(
                "api",
                root,
                providers.First(),
                null,
                description: "The united api access");

            foreach (var apiProvider in providers.Skip(1))
            {
                apiField.AddProvider(apiProvider, null);
            }

            this.Fields["api"] = apiField;
        }