示例#1
0
        private static void MapAttributeRoutesInternal(this RouteCollection routes,
                                                       AttributeRoutingConfiguration configuration)
        {
            var generatedRoutes = new RouteBuilder(configuration).BuildAllRoutes();

            generatedRoutes.ToList().ForEach(r => routes.Add(r.Name, r));
        }
        /// <summary>
        /// Scans the specified assemblies for all routes defined with AttributeRouting attributes,
        /// and applies configuration options against the routes found.
        /// </summary>
        /// <param name="configurationAction">
        /// The initialization action that builds the configuration object.
        /// </param>
        public static void MapAttributeRoutes(this RouteCollection routes, Action <AttributeRoutingConfiguration> configurationAction)
        {
            var configuration = new AttributeRoutingConfiguration();

            configurationAction.Invoke(configuration);

            routes.MapAttributeRoutesInternal(configuration);
        }
示例#3
0
        /// <summary>
        /// Scans the calling assembly for all routes defined with AttributeRouting attributes,
        /// using the default conventions.
        /// </summary>
        public static void MapAttributeRoutes(this RouteCollection routes)
        {
            var configuration = new AttributeRoutingConfiguration();

            configuration.ScanAssembly(Assembly.GetCallingAssembly());

            routes.MapAttributeRoutesInternal(configuration);
        }
示例#4
0
 /// <summary>
 /// Scans the specified assemblies for all routes defined with AttributeRouting attributes,
 /// and applies configuration options against the routes found.
 /// </summary>
 /// <param name="configuration">
 /// The configuration object.
 /// </param>
 public static void MapAttributeRoutes(this RouteCollection routes, AttributeRoutingConfiguration configuration)
 {
     routes.MapAttributeRoutesInternal(configuration);
 }
示例#5
0
 /// <summary>
 /// Helper for configuring areas when initializing AttributeRouting framework.
 /// </summary>
 public AreaConfiguration(string name, AttributeRoutingConfiguration configuration)
 {
     _name          = name;
     _configuration = configuration;
 }