コード例 #1
0
ファイル: Schema.cs プロジェクト: max2525nap/hotchocolate
        internal Schema(SchemaDefinition definition)
        {
            if (definition == null)
            {
                throw new ArgumentNullException(nameof(definition));
            }

            Description    = definition.Description;
            Directives     = definition.Directives;
            Services       = definition.Services;
            Options        = definition.Options;
            DirectiveTypes = definition.DirectiveTypes;

            _types          = new SchemaTypes(definition);
            _directiveTypes = DirectiveTypes.ToDictionary(t => t.Name);
        }
コード例 #2
0
        internal void CompleteSchema(
            SchemaTypesDefinition schemaTypesDefinition)
        {
            if (schemaTypesDefinition == null)
            {
                throw new ArgumentNullException(nameof(schemaTypesDefinition));
            }

            if (_sealed)
            {
                throw new InvalidOperationException(
                          "This schema is already sealed and cannot be mutated.");
            }

            DirectiveTypes  = schemaTypesDefinition.DirectiveTypes;
            _types          = new SchemaTypes(schemaTypesDefinition);
            _directiveTypes = DirectiveTypes.ToDictionary(t => t.Name);
            _sealed         = true;
        }