コード例 #1
0
            /// <summary>
            /// Create.
            /// </summary>
            /// <param name="controller">The logic controller.</param>
            public DisabledLazyLoadScope(LogicController <U, D, S> controller)
            {
                if (controller == null)
                {
                    throw new ArgumentNullException(nameof(controller));
                }

                this.controller = controller;

                originalLazyLoadValue = controller.LogicSession.IsLazyLoadingEnabled;

                controller.LogicSession.IsLazyLoadingEnabled = false;
            }
コード例 #2
0
            internal ActionExecutionModelMetadataProviderScope(
                LogicController <U, D, S> controller,
                ActionExecutionModel actionExecutionModel)
            {
                this.controller           = controller;
                this.actionExecutionModel = actionExecutionModel;

                originalModelMetadataProvider = controller.MetadataProvider;
                originalObjectModelValidator  = controller.ObjectValidator;

                controller.MetadataProvider = this;

                var mvcOptions = controller.HttpContext.RequestServices.GetRequiredService <IOptions <MvcOptions> >().Value;

                controller.ObjectValidator = new MetadataObjectModelValidator(
                    this,
                    mvcOptions.ModelValidatorProviders,
                    mvcOptions);
            }