Example #1
0
        protected override void OnRegisterDependencies(
            ITypeInitializationContext context)
        {
            base.OnRegisterDependencies(context);

            if (Locations.Count == 0)
            {
                context.ReportError(new SchemaError(
                                        $"The `{Name}` directive does not declare any " +
                                        "location on which it is valid."));
            }

            foreach (INeedsInitialization argument in Arguments
                     .Cast <INeedsInitialization>())
            {
                argument.RegisterDependencies(context);
            }

            if (_middleware != null)
            {
                context.RegisterMiddleware(_middleware);
            }
        }