Beispiel #1
0
        /// <summary>
        /// Scans the calling assembly for all routes defined with AttributeRouting attributes,
        /// using the default conventions.
        /// </summary>
        public static void MapHttpAttributeRoutes(this HttpRouteCollection routes)
        {
            var configuration = new HttpWebAttributeRoutingConfiguration();

            configuration.AddRoutesFromAssembly(Assembly.GetCallingAssembly());

            routes.MapHttpAttributeRoutesInternal(configuration);
        }
Beispiel #2
0
        /// <summary>
        /// Scans the specified assemblies for all routes defined with AttributeRouting attributes,
        /// and applies configuration options against the routes found.
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="configurationAction">The initialization action that builds the configuration object</param>
        public static void MapHttpAttributeRoutes(this HttpRouteCollection routes, Action <HttpWebAttributeRoutingConfiguration> configurationAction)
        {
            var configuration = new HttpWebAttributeRoutingConfiguration();

            configurationAction.Invoke(configuration);

            routes.MapHttpAttributeRoutesInternal(configuration);
        }
Beispiel #3
0
        /// <summary>
        /// Scans the specified assemblies for all routes defined with AttributeRouting attributes,
        /// and applies configuration options against the routes found.
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="configurationAction">The initialization action that builds the configuration object</param>
        public static void MapHttpAttributeRoutes(this HttpRouteCollection routes, Action <HttpWebConfiguration> configurationAction)
        {
            var configuration = new HttpWebConfiguration();

            configurationAction.Invoke(configuration);

            if (configuration.InMemory)
            {
                var newConfig = new HttpWebConfiguration(inMemory: true);
                configurationAction.Invoke(newConfig);
                routes.MapHttpAttributeRoutesInternal(newConfig);
            }
            else
            {
                routes.MapHttpAttributeRoutesInternal(configuration);
            }
        }
Beispiel #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="routes"> </param>
 /// <param name="configuration">The configuration object</param>
 public static void MapHttpAttributeRoutes(this HttpRouteCollection routes, HttpWebAttributeRoutingConfiguration configuration)
 {
     routes.MapHttpAttributeRoutesInternal(configuration);
 }