private void ProvideConstraint(ActionConstraintItem item, IServiceProvider services)
        {
            // Don't overwrite anything that was done by a previous provider.
            if (item.Constraint != null)
            {
                return;
            }

            var constraint = item.Metadata as IActionConstraint;

            if (constraint != null)
            {
                item.Constraint = constraint;
                item.IsReusable = true;
                return;
            }

            var factory = item.Metadata as IActionConstraintFactory;

            if (factory != null)
            {
                item.Constraint = factory.CreateInstance(services);
                item.IsReusable = factory.IsReusable;
                return;
            }
        }
        private void ProvideConstraint(ActionConstraintItem item, IFeatureActionConstraintFactory <TFeature> factory)
        {
            // Don't overwrite anything that was done by a previous provider.
            if (item.Constraint != null)
            {
                return;
            }

            if (item.Metadata is IFeatureActionConstraintMetadata <TFeature> constraintMetadata)
            {
                item.Constraint = factory.CreateInstance(constraintMetadata);
                item.IsReusable = true;
            }
        }