public override void RegisterRoutes(IRouteBuilder routeBuilder)
        {
            _subMapper?.Invoke(this);

            var routes = new List <Route>();

            AddIncludedActions(routeBuilder, routes);

            routes.AddRange(
                _members.Select(member => MemberRoute(routeBuilder, member.Key, member.Value.Key, member.Value.Value)));

            foreach (var route in routes)
            {
                ConfigureRoute(route);
                routeBuilder.Routes.Add(route);
            }

            if (Mappers.Any())
            {
                BasePath = ResourcePath;

                AddResourcePath(SingularResourceName);
                RegisterNested(routeBuilder, mapper => mapper.SetParentResources(ResourcePaths));
            }
        }
Пример #2
0
        public override void RegisterRoutes(IRouteBuilder routeBuilder)
        {
            _subMapper?.Invoke(this);

            var routes =
                _collections.Select(
                    collection =>
                    CollectionRoute(routeBuilder, collection.Key, collection.Value.Key, collection.Value.Value))
                .ToList();

            AddIncludedActions(routeBuilder, routes);
            routes.AddRange(
                _members.Select(member => MemberRoute(routeBuilder, member.Key, member.Value.Key, member.Value.Value)));

            foreach (var route in routes)
            {
                ConfigureRoute(route);
                routeBuilder.Routes.Add(route);
            }

            if (Mappers.Any())
            {
                var parentIdParameterName = SingularResourceName + Inflector.Capitalize(IdParameterName);
                BasePath = Join(ResourcePath, $"{{{parentIdParameterName}}}");
                var idConstraint = Constraints[IdParameterName];
                if (idConstraint != null)
                {
                    Constraints.Remove(IdParameterName);
                    Constraints.Add(parentIdParameterName, idConstraint);
                }

                AddResourcePath(SingularResourceName);
                RegisterNested(routeBuilder, mapper => mapper.SetParentResources(ResourcePaths));
            }
        }
Пример #3
0
        public override void RegisterRoutes(RouteCollection routeCollection)
        {
            if (_subMapper != null)
            {
                _subMapper.Invoke(this);
            }

            var routes = new List <Route>();

            AddIncludedActions(routes);

            routes.AddRange(_members.Select(member => MemberRoute(member.Key, member.Value.Key, member.Value.Value)));

            if (GenerateFormatRoutes)
            {
                AddFormatRoutes(routes);
            }

            foreach (var route in routes)
            {
                ConfigureRoute(route);
                routeCollection.Add(route);
            }

            if (Mappers.Any())
            {
                BasePath = ResourcePath;

                AddResourcePath(SingularResourceName);
                RegisterNested(routeCollection, mapper => mapper.SetParentResources(ResourcePaths));
            }
        }
Пример #4
0
        public override void RegisterRoutes(RouteCollection routeCollection)
        {
            if (subMapper != null)
            {
                subMapper.Invoke(this);
            }

            var routes = collections.Select(collection => CollectionRoute(collection.Key, collection.Value.Key, collection.Value.Value)).ToList();

            AddIncludedActions(routes);

            routes.AddRange(members.Select(member => MemberRoute(member.Key, member.Value.Key, member.Value.Value)));

            if (GenerateFormatRoutes)
            {
                AddFormatRoutes(routes);
            }

            foreach (var route in routes)
            {
                ConfigureRoute(route);
                AppendRouteTo(routeCollection, route);
            }

            if (Mappers.Any())
            {
                string parentIdParameterName = SingularResourceName + Inflector.Capitalize(IdParameterName);
                BasePath = Join(ResourcePath, "{" + parentIdParameterName + "}");
                var idConstraint = Constraints[IdParameterName];
                if (idConstraint != null)
                {
                    Constraints.Remove(IdParameterName);
                    Constraints.Add(parentIdParameterName, idConstraint);
                }

                AddResourcePath(SingularResourceName);
                RegisterNested(routeCollection, mapper => mapper.SetParentResources(ResourcePaths));
            }
        }
        public override void RegisterRoutes(RouteCollection routeCollection)
        {
            var routes = new List <Route>();

            AddIncludedActions(routes);

            if (GenerateFormatRoutes)
            {
                AddFormatRoutes(routes);
            }

            foreach (var route in routes)
            {
                routeCollection.Add(route);
            }

            if (Mappers.Any())
            {
                var singular = Inflector.Singularize(base.ResourceName);
                BasePath = Join(base.ResourcePath, "{" + singular + "Id}");

                RegisterNested(routeCollection);
            }
        }