Esempio n. 1
0
        public ActionModel([NotNull] ActionModel other)
        {
            ActionMethod = other.ActionMethod;
            ActionName   = other.ActionName;

            // Not making a deep copy of the controller, this action still belongs to the same controller.
            Controller = other.Controller;

            // These are just metadata, safe to create new collections
            ActionConstraints = new List <IActionConstraintMetadata>(other.ActionConstraints);
            Attributes        = new List <object>(other.Attributes);
            Filters           = new List <IFilter>(other.Filters);
            HttpMethods       = new List <string>(other.HttpMethods);
            Properties        = new Dictionary <object, object>(other.Properties);

            // Make a deep copy of other 'model' types.
            ApiExplorer      = new ApiExplorerModel(other.ApiExplorer);
            Parameters       = new List <ParameterModel>(other.Parameters.Select(p => new ParameterModel(p)));
            RouteConstraints = new List <IRouteConstraintProvider>(other.RouteConstraints);

            if (other.AttributeRouteModel != null)
            {
                AttributeRouteModel = new AttributeRouteModel(other.AttributeRouteModel);
            }
        }
Esempio n. 2
0
        public ControllerModel(
            TypeInfo controllerType,
            IReadOnlyList<object> attributes)
        {
            if (controllerType == null)
            {
                throw new ArgumentNullException(nameof(controllerType));
            }

            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            ControllerType = controllerType;

            Actions = new List<ActionModel>();
            ApiExplorer = new ApiExplorerModel();
            Attributes = new List<object>(attributes);
            AttributeRoutes = new List<AttributeRouteModel>();
            ActionConstraints = new List<IActionConstraintMetadata>();
            Filters = new List<IFilterMetadata>();
            RouteConstraints = new List<IRouteConstraintProvider>();
            Properties = new Dictionary<object, object>();
            ControllerProperties = new List<PropertyModel>();
        }
Esempio n. 3
0
        public ControllerModel(ControllerModel other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            ControllerName = other.ControllerName;
            ControllerType = other.ControllerType;

            // Still part of the same application
            Application = other.Application;

            // These are just metadata, safe to create new collections
            ActionConstraints = new List<IActionConstraintMetadata>(other.ActionConstraints);
            Attributes = new List<object>(other.Attributes);
            Filters = new List<IFilterMetadata>(other.Filters);
            RouteConstraints = new List<IRouteConstraintProvider>(other.RouteConstraints);
            Properties = new Dictionary<object, object>(other.Properties);

            // Make a deep copy of other 'model' types.
            Actions = new List<ActionModel>(other.Actions.Select(a => new ActionModel(a)));
            ApiExplorer = new ApiExplorerModel(other.ApiExplorer);
            AttributeRoutes = new List<AttributeRouteModel>(
                other.AttributeRoutes.Select(a => new AttributeRouteModel(a)));
            ControllerProperties =
                new List<PropertyModel>(other.ControllerProperties.Select(p => new PropertyModel(p)));
        }
Esempio n. 4
0
        public ActionModel(
            MethodInfo actionMethod,
            IReadOnlyList<object> attributes)
        {
            if (actionMethod == null)
            {
                throw new ArgumentNullException(nameof(actionMethod));
            }

            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            ActionMethod = actionMethod;

            ApiExplorer = new ApiExplorerModel();
            Attributes = new List<object>(attributes);
            ActionConstraints = new List<IActionConstraintMetadata>();
            Filters = new List<IFilterMetadata>();
            HttpMethods = new List<string>();
            Parameters = new List<ParameterModel>();
            RouteConstraints = new List<IRouteConstraintProvider>();
            Properties = new Dictionary<object, object>();
        }
Esempio n. 5
0
        public ActionModel(ActionModel other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            ActionMethod = other.ActionMethod;
            ActionName = other.ActionName;

            // Not making a deep copy of the controller, this action still belongs to the same controller.
            Controller = other.Controller;

            // These are just metadata, safe to create new collections
            ActionConstraints = new List<IActionConstraintMetadata>(other.ActionConstraints);
            Attributes = new List<object>(other.Attributes);
            Filters = new List<IFilterMetadata>(other.Filters);
            HttpMethods = new List<string>(other.HttpMethods);
            Properties = new Dictionary<object, object>(other.Properties);

            // Make a deep copy of other 'model' types.
            ApiExplorer = new ApiExplorerModel(other.ApiExplorer);
            Parameters = new List<ParameterModel>(other.Parameters.Select(p => new ParameterModel(p)));
            RouteConstraints = new List<IRouteConstraintProvider>(other.RouteConstraints);

            if (other.AttributeRouteModel != null)
            {
                AttributeRouteModel = new AttributeRouteModel(other.AttributeRouteModel);
            }
        }
Esempio n. 6
0
 public ApplicationModel()
 {
     ApiExplorer = new ApiExplorerModel();
     Controllers = new List<ControllerModel>();
     Filters = new List<IFilter>();
     Properties = new Dictionary<object, object>();
 }
Esempio n. 7
0
        public ControllerModel(ControllerModel other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            ControllerName = other.ControllerName;
            ControllerType = other.ControllerType;

            // Still part of the same application
            Application = other.Application;

            // These are just metadata, safe to create new collections
            ActionConstraints = new List <IActionConstraintMetadata>(other.ActionConstraints);
            Attributes        = new List <object>(other.Attributes);
            Filters           = new List <IFilterMetadata>(other.Filters);
            RouteConstraints  = new List <IRouteConstraintProvider>(other.RouteConstraints);
            Properties        = new Dictionary <object, object>(other.Properties);

            // Make a deep copy of other 'model' types.
            Actions         = new List <ActionModel>(other.Actions.Select(a => new ActionModel(a)));
            ApiExplorer     = new ApiExplorerModel(other.ApiExplorer);
            AttributeRoutes = new List <AttributeRouteModel>(
                other.AttributeRoutes.Select(a => new AttributeRouteModel(a)));
            ControllerProperties =
                new List <PropertyModel>(other.ControllerProperties.Select(p => new PropertyModel(p)));
        }
Esempio n. 8
0
        public ControllerModel(
            TypeInfo controllerType,
            IReadOnlyList <object> attributes)
        {
            if (controllerType == null)
            {
                throw new ArgumentNullException(nameof(controllerType));
            }

            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            ControllerType = controllerType;

            Actions              = new List <ActionModel>();
            ApiExplorer          = new ApiExplorerModel();
            Attributes           = new List <object>(attributes);
            AttributeRoutes      = new List <AttributeRouteModel>();
            ActionConstraints    = new List <IActionConstraintMetadata>();
            Filters              = new List <IFilterMetadata>();
            RouteConstraints     = new List <IRouteConstraintProvider>();
            Properties           = new Dictionary <object, object>();
            ControllerProperties = new List <PropertyModel>();
        }
Esempio n. 9
0
        public ActionModel(
            MethodInfo actionMethod,
            IReadOnlyList <object> attributes)
        {
            if (actionMethod == null)
            {
                throw new ArgumentNullException(nameof(actionMethod));
            }

            if (attributes == null)
            {
                throw new ArgumentNullException(nameof(attributes));
            }

            ActionMethod = actionMethod;

            ApiExplorer       = new ApiExplorerModel();
            Attributes        = new List <object>(attributes);
            ActionConstraints = new List <IActionConstraintMetadata>();
            Filters           = new List <IFilterMetadata>();
            HttpMethods       = new List <string>();
            Parameters        = new List <ParameterModel>();
            RouteConstraints  = new List <IRouteConstraintProvider>();
            Properties        = new Dictionary <object, object>();
        }
Esempio n. 10
0
 public ApplicationModel()
 {
     ApiExplorer = new ApiExplorerModel();
     Controllers = new List <ControllerModel>();
     Filters     = new List <IFilter>();
     Properties  = new Dictionary <object, object>();
 }
 public ApiExplorerModelValues(ApiExplorerModel inner)
 {
     if (inner != null)
     {
         IsVisible = inner.IsVisible;
         GroupName = inner.GroupName;
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Creates a new <see cref="ApiExplorerModel"/> with properties copied from <paramref name="other"/>.
        /// </summary>
        /// <param name="other">The <see cref="ApiExplorerModel"/> to copy.</param>
        public ApiExplorerModel(ApiExplorerModel other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            GroupName = other.GroupName;
            IsVisible = other.IsVisible;
        }
Esempio n. 13
0
        /// <summary>
        /// Creates a new <see cref="ApiExplorerModel"/> with properties copied from <paramref name="other"/>.
        /// </summary>
        /// <param name="other">The <see cref="ApiExplorerModel"/> to copy.</param>
        public ApiExplorerModel(ApiExplorerModel other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            GroupName = other.GroupName;
            IsVisible = other.IsVisible;
        }
Esempio n. 14
0
        public ActionModel([NotNull] MethodInfo actionMethod,
                           [NotNull] IReadOnlyList <object> attributes)
        {
            ActionMethod = actionMethod;

            ApiExplorer       = new ApiExplorerModel();
            Attributes        = new List <object>(attributes);
            ActionConstraints = new List <IActionConstraintMetadata>();
            Filters           = new List <IFilter>();
            HttpMethods       = new List <string>();
            Parameters        = new List <ParameterModel>();
        }
Esempio n. 15
0
        public ControllerModel([NotNull] TypeInfo controllerType,
                               [NotNull] IReadOnlyList <object> attributes)
        {
            ControllerType = controllerType;

            Actions           = new List <ActionModel>();
            ApiExplorer       = new ApiExplorerModel();
            Attributes        = new List <object>(attributes);
            AttributeRoutes   = new List <AttributeRouteModel>();
            ActionConstraints = new List <IActionConstraintMetadata>();
            Filters           = new List <IFilter>();
            RouteConstraints  = new List <IRouteConstraintProvider>();
        }
Esempio n. 16
0
        public ActionModel([NotNull] MethodInfo actionMethod,
                           [NotNull] IReadOnlyList<object> attributes)
        {
            ActionMethod = actionMethod;

            ApiExplorer = new ApiExplorerModel();
            Attributes = new List<object>(attributes);
            ActionConstraints = new List<IActionConstraintMetadata>();
            Filters = new List<IFilter>();
            HttpMethods = new List<string>();
            Parameters = new List<ParameterModel>();
            RouteConstraints = new List<IRouteConstraintProvider>();
            Properties = new Dictionary<object, object>();
        }
Esempio n. 17
0
        public ControllerModel([NotNull] TypeInfo controllerType,
                               [NotNull] IReadOnlyList<object> attributes)
        {
            ControllerType = controllerType;

            Actions = new List<ActionModel>();
            ApiExplorer = new ApiExplorerModel();
            Attributes = new List<object>(attributes);
            AttributeRoutes = new List<AttributeRouteModel>();
            ActionConstraints = new List<IActionConstraintMetadata>();
            Filters = new List<IFilter>();
            RouteConstraints = new List<IRouteConstraintProvider>();
            Properties = new Dictionary<object, object>();
            ControllerProperties = new List<PropertyModel>();
        }
Esempio n. 18
0
        public ControllerModel([NotNull] ControllerModel other)
        {
            ControllerName = other.ControllerName;
            ControllerType = other.ControllerType;

            // Still part of the same application
            Application = other.Application;

            // These are just metadata, safe to create new collections
            ActionConstraints = new List <IActionConstraintMetadata>(other.ActionConstraints);
            Attributes        = new List <object>(other.Attributes);
            Filters           = new List <IFilter>(other.Filters);
            RouteConstraints  = new List <IRouteConstraintProvider>(other.RouteConstraints);

            // Make a deep copy of other 'model' types.
            Actions         = new List <ActionModel>(other.Actions.Select(a => new ActionModel(a)));
            ApiExplorer     = new ApiExplorerModel(other.ApiExplorer);
            AttributeRoutes = new List <AttributeRouteModel>(
                other.AttributeRoutes.Select(a => new AttributeRouteModel(a)));
        }
Esempio n. 19
0
 /// <summary>
 /// Creates a new <see cref="ApiExplorerModel"/> with properties copied from <paramref name="other"/>.
 /// </summary>
 /// <param name="other">The <see cref="ApiExplorerModel"/> to copy.</param>
 public ApiExplorerModel([NotNull] ApiExplorerModel other)
 {
     GroupName = other.GroupName;
     IsVisible = other.IsVisible;
 }