public ApplicationModel() { ApiExplorer = new ApiExplorerModel(); Controllers = new List<ControllerModel>(); Filters = new List<IFilterMetadata>(); Properties = new Dictionary<object, object>(); }
/// <summary> /// Initializes a new instance of the <see cref="ODataApiExplorerModel"/> class. /// </summary> /// <param name="other">The other <see cref="ApiExplorerModel">model</see> to copy from.</param> public ODataApiExplorerModel(ApiExplorerModel other) : base(other) { Arg.NotNull(other, nameof(other)); IsVisible = null; IsODataVisible = other.IsVisible; }
/// <summary> /// Initializes a new instance of <see cref="ControllerModel"/>. /// </summary> /// <param name="controllerType">The type of the controller.</param> /// <param name="attributes">The attributes.</param> 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); ControllerProperties = new List <PropertyModel>(); Filters = new List <IFilterMetadata>(); Properties = new Dictionary <object, object>(); RouteValues = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); Selectors = new List <SelectorModel>(); }
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 Attributes = new List<object>(other.Attributes); Filters = new List<IFilterMetadata>(other.Filters); RouteValues = new Dictionary<string, string>(other.RouteValues, StringComparer.OrdinalIgnoreCase); 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); ControllerProperties = new List<PropertyModel>(other.ControllerProperties.Select(p => new PropertyModel(p))); Selectors = new List<SelectorModel>(other.Selectors.Select(s => new SelectorModel(s))); }
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); ControllerProperties = new List<PropertyModel>(); Filters = new List<IFilterMetadata>(); Properties = new Dictionary<object, object>(); RouteValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); Selectors = new List<SelectorModel>(); }
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); ControllerProperties = new List <PropertyModel>(); Filters = new List <IFilterMetadata>(); Properties = new Dictionary <object, object>(); RouteConstraints = new List <IRouteConstraintProvider>(); Selectors = new List <SelectorModel>(); }
/// <summary> /// Initializes a new instance of <see cref="ControllerModel"/>. /// </summary> /// <param name="other">The other controller model.</param> 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 Attributes = new List <object>(other.Attributes); Filters = new List <IFilterMetadata>(other.Filters); RouteValues = new Dictionary <string, string>(other.RouteValues, StringComparer.OrdinalIgnoreCase); 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) { Controller = this })); ApiExplorer = new ApiExplorerModel(other.ApiExplorer); ControllerProperties = new List <PropertyModel>(other.ControllerProperties.Select(p => new PropertyModel(p) { Controller = this })); Selectors = new List <SelectorModel>(other.Selectors.Select(s => new SelectorModel(s))); }
public ApplicationModel() { ApiExplorer = new ApiExplorerModel(); Controllers = new List <ControllerModel>(); Filters = new List <IFilterMetadata>(); Properties = new Dictionary <object, object>(); }
/// <summary> /// Copy constructor for <see cref="ActionModel"/>. /// </summary> /// <param name="other">The <see cref="ActionModel"/> to copy.</param> public ActionModel(ActionModel other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } ActionMethod = other.ActionMethod; ActionName = other.ActionName; RouteParameterTransformer = other.RouteParameterTransformer; // 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 Attributes = new List <object>(other.Attributes); Filters = new List <IFilterMetadata>(other.Filters); Properties = new Dictionary <object, object>(other.Properties); RouteValues = new Dictionary <string, string>(other.RouteValues, StringComparer.OrdinalIgnoreCase); // Make a deep copy of other 'model' types. ApiExplorer = new ApiExplorerModel(other.ApiExplorer); Parameters = new List <ParameterModel>(other.Parameters.Select(p => new ParameterModel(p) { Action = this })); Selectors = new List <SelectorModel>(other.Selectors.Select(s => new SelectorModel(s))); }
/// <summary> /// Returns a value indicating whether the specified model is visible to OData. /// </summary> /// <param name="model">The <see cref="ApiExplorerModel">model</see> to evaluate.</param> /// <returns>True if the associated controller or action is visible to OData; otherwise, false.</returns> public static bool?IsODataVisible(this ApiExplorerModel model) { if (model == null) { throw new ArgumentNullException(nameof(model)); } return(model is ODataApiExplorerModel odataModel ? odataModel.IsODataVisible : model.IsVisible); }
/// <summary> /// Initializes a new instance of the <see cref="ODataApiExplorerModel"/> class. /// </summary> /// <param name="other">The other <see cref="ApiExplorerModel">model</see> to copy from.</param> public ODataApiExplorerModel(ApiExplorerModel other) : base(other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } IsVisible = null; IsODataVisible = other.IsVisible; }
/// <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; }
/// <summary> /// Initializes a new instance of <see cref="ActionModel"/>. /// </summary> /// <param name="actionMethod">The action <see cref="MethodInfo"/>.</param> /// <param name="attributes">The attributes associated with the action.</param> public ActionModel( MethodInfo actionMethod, IReadOnlyList <object> attributes) { if (attributes == null) { throw new ArgumentNullException(nameof(attributes)); } ActionMethod = actionMethod ?? throw new ArgumentNullException(nameof(actionMethod)); ApiExplorer = new ApiExplorerModel(); Attributes = new List <object>(attributes); Filters = new List <IFilterMetadata>(); Parameters = new List <ParameterModel>(); RouteValues = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase); Properties = new Dictionary <object, object>(); Selectors = new List <SelectorModel>(); }
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); Filters = new List <IFilterMetadata>(); Parameters = new List <ParameterModel>(); RouteConstraints = new List <IRouteConstraintProvider>(); Properties = new Dictionary <object, object>(); Selectors = new List <SelectorModel>(); }
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 Attributes = new List<object>(other.Attributes); Filters = new List<IFilterMetadata>(other.Filters); Properties = new Dictionary<object, object>(other.Properties); RouteValues = new Dictionary<string, string>(other.RouteValues, StringComparer.OrdinalIgnoreCase); // Make a deep copy of other 'model' types. ApiExplorer = new ApiExplorerModel(other.ApiExplorer); Parameters = new List<ParameterModel>(other.Parameters.Select(p => new ParameterModel(p))); Selectors = new List<SelectorModel>(other.Selectors.Select(s => new SelectorModel(s))); }
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); Filters = new List<IFilterMetadata>(); Parameters = new List<ParameterModel>(); RouteValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); Properties = new Dictionary<object, object>(); Selectors = new List<SelectorModel>(); }
/// <summary> /// Returns a value indicating whether the specified model is visible to OData. /// </summary> /// <param name="model">The <see cref="ApiExplorerModel">model</see> to evaluate.</param> /// <returns>True if the associated controller or action is visible to OData; otherwise, false.</returns> public static bool?IsODataVisible(this ApiExplorerModel model) { Arg.NotNull(model, nameof(model)); return(model is ODataApiExplorerModel odataModel ? odataModel.IsODataVisible : model.IsVisible); }