Exemplo n.º 1
0
        private static void MapDeleteComponents(CompositionMetadataRegistry compositionMetadataRegistry, ICollection <EndpointDataSource> dataSources, CompositionOverControllersOptions compositionOverControllersOptions, ResponseCasing defaultCasing)
        {
            var componentsGroupedByTemplate = SelectComponentsGroupedByTemplate <HttpDeleteAttribute>(compositionMetadataRegistry, compositionOverControllersOptions.UseCaseInsensitiveRouteMatching);

            foreach (var componentsGroup in componentsGroupedByTemplate)
            {
                var builder = CreateCompositionEndpointBuilder(componentsGroup, new HttpMethodMetadata(new[] { HttpMethods.Delete }), defaultCasing);

                AppendToDataSource(dataSources, builder);
            }
        }
Exemplo n.º 2
0
        private static void MapPostComponents(CompositionMetadataRegistry compositionMetadataRegistry, ICollection <EndpointDataSource> dataSources, CompositionOverControllersOptions compositionOverControllersOptions, ResponseCasing defaultCasing)
        {
            var componentsGroupedByTemplate = SelectComponentsGroupedByTemplate <HttpPostAttribute>(compositionMetadataRegistry, compositionOverControllersOptions.UseCaseInsensitiveRouteMatching);

            foreach (var componentsGroup in componentsGroupedByTemplate)
            {
                if (compositionOverControllersOptions.IsEnabled && ThereIsAlreadyAnEndpointForTheSameTemplate(componentsGroup, dataSources,
                                                                                                              compositionOverControllersOptions.UseCaseInsensitiveRouteMatching, out var endpoint))
                {
                    var componentTypes = componentsGroup.Select(c => c.ComponentType).ToArray();
                    compositionOverControllerPostComponents[componentsGroup.Key] = componentTypes;
                }
                else
                {
                    var builder = CreateCompositionEndpointBuilder(componentsGroup, new HttpMethodMetadata(new[] { HttpMethods.Post }), defaultCasing);
                    AppendToDataSource(dataSources, builder);
                }
            }
        }
 public CompositionOverControllersActionFilter(CompositionOverControllersRoutes compositionOverControllersRoutes, ViewModelCompositionOptions viewModelCompositionOptions)
 {
     _compositionOverControllersRoutes  = compositionOverControllersRoutes;
     _compositionOverControllersOptions = viewModelCompositionOptions.CompositionOverControllersOptions;
 }