Beispiel #1
0
 public static void SetRoutes(IServiceRoutes Routes)
 {
     Routes
     .Add <Order>("/order", "GET")
     .Add <Order>("/order/{Id}", "GET")
     .Add <Order>("/order", "PUT");
 }
Beispiel #2
0
 public static void SetRoutes(IServiceRoutes Routes)
 {
     Routes
         .Add<Order>("/order", "GET")
         .Add<Order>("/order/{Id}", "GET")
         .Add<Order>("/order", "PUT");
 }
        public static void InitDatabaseRoutes(this Funq.Container container, IServiceRoutes routes)
        {
            if (container.InitMySQL())
            {
                routes.Add<MySqlDbRequest>("/mysql/db", "GET");
                routes.Add<MySqlQueriesRequest>("/mysql/queries/{queries}", "GET");
                routes.Add<MySqlFortunesRequest>("/mysql/fortunes", "GET");
                routes.Add<MySqlUpdatesRequest>("/mysql/updates/{queries}", "GET");
                routes.Add<MySqlCachedDbRequest>("/mysql/cached/db", "GET");
            }

            if (container.InitPostgreSQL())
            {
                routes.Add<PostgreSqlDbRequest>("/postgresql/db", "GET");
                routes.Add<PostgreSqlQueriesRequest>("/postgresql/queries/{queries}", "GET");
                routes.Add<PostgreSqlFortunesRequest>("/postgresql/fortunes", "GET");
                routes.Add<PostgreSqlUpdatesRequest>("/postgresql/updates/{queries}", "GET");
                routes.Add<PostgreSqlCachedDbRequest>("/postgresql/cached/db", "GET");
            }

            if (container.InitSQLServer())
            {
                routes.Add<SqlServerDbRequest>("/sqlserver/db", "GET");
                routes.Add<SqlServerQueriesRequest>("/sqlserver/queries/{queries}", "GET");
                routes.Add<SqlServerFortunesRequest>("/sqlserver/fortunes", "GET");
                routes.Add<SqlServerUpdatesRequest>("/sqlserver/updates/{queries}", "GET");
                routes.Add<SqlServerCachedDbRequest>("/sqlserver/cached/db", "GET");
            }
        }
Beispiel #4
0
        public static void InitDatabaseRoutes(this Funq.Container container, IServiceRoutes routes)
        {
            if (container.InitMySQL())
            {
                routes.Add <MySqlDbRequest>("/mysql/db", "GET");
                routes.Add <MySqlQueriesRequest>("/mysql/queries/{queries}", "GET");
                routes.Add <MySqlFortunesRequest>("/mysql/fortunes", "GET");
                routes.Add <MySqlUpdatesRequest>("/mysql/updates/{queries}", "GET");
                routes.Add <MySqlCachedDbRequest>("/mysql/cached/db", "GET");
            }

            if (container.InitPostgreSQL())
            {
                routes.Add <PostgreSqlDbRequest>("/postgresql/db", "GET");
                routes.Add <PostgreSqlQueriesRequest>("/postgresql/queries/{queries}", "GET");
                routes.Add <PostgreSqlFortunesRequest>("/postgresql/fortunes", "GET");
                routes.Add <PostgreSqlUpdatesRequest>("/postgresql/updates/{queries}", "GET");
                routes.Add <PostgreSqlCachedDbRequest>("/postgresql/cached/db", "GET");
            }

            if (container.InitSQLServer())
            {
                routes.Add <SqlServerDbRequest>("/sqlserver/db", "GET");
                routes.Add <SqlServerQueriesRequest>("/sqlserver/queries/{queries}", "GET");
                routes.Add <SqlServerFortunesRequest>("/sqlserver/fortunes", "GET");
                routes.Add <SqlServerUpdatesRequest>("/sqlserver/updates/{queries}", "GET");
                routes.Add <SqlServerCachedDbRequest>("/sqlserver/cached/db", "GET");
            }
        }
Beispiel #5
0
        private static void AddNewApiRoutes(IServiceRoutes routes, Assembly assembly)
        {
            var services = assembly.GetExportedTypes()
                           .Where(t => !t.IsAbstract &&
                                  t.HasInterface(typeof(IService)));

            foreach (Type service in services)
            {
                var allServiceActions = service.GetActions();
                foreach (var requestDtoActions in allServiceActions.GroupBy(x => x.GetParameters()[0].ParameterType))
                {
                    var    requestType  = requestDtoActions.Key;
                    var    hasWildcard  = requestDtoActions.Any(x => x.Name.EqualsIgnoreCase(ActionContext.AnyAction));
                    string allowedVerbs = null; //null == All Routes
                    if (!hasWildcard)
                    {
                        var allowedMethods = new List <string>();
                        foreach (var action in requestDtoActions)
                        {
                            allowedMethods.Add(action.Name.ToUpper());
                        }

                        if (allowedMethods.Count == 0)
                        {
                            continue;
                        }
                        allowedVerbs = string.Join(" ", allowedMethods.ToArray());
                    }

                    routes.AddRoute(requestType, allowedVerbs);
                }
            }
        }
Beispiel #6
0
 public static void WithRequestDtoName(IServiceRoutes routes, Type requestType, string allowedVerbs)
 {
     routes.Add(new RestPath(requestType, $"/{requestType.GetOperationName()}", verbs: allowedVerbs)
     {
         Priority = AutoGenPriority
     });
 }
Beispiel #7
0
 private static void AddRoute(this IServiceRoutes routes, Type requestType, string allowedVerbs)
 {
     foreach (var strategy in HostContext.Config.RouteNamingConventions)
     {
         strategy(routes, requestType, allowedVerbs);
     }
 }
		/// <summary>
		/// Sets service routes
		/// </summary>
		public HostBootstrapper Bootstrap(IServiceRoutes routes)
		{
			routes.Add<Api.Messages.Countries>("/countries/{language}", "GET, HEAD");
			routes.Add<Api.Messages.Countries>("/countries", "GET, HEAD");

			return this;
		}
Beispiel #9
0
 public void Init(
     Container container, 
     IList<IPlugin> plugins,
     IServiceRoutes routes,
     EndpointHostConfig endpointHostconfig
     )
 {
 }
 private static void AddRoute(this IServiceRoutes routes, Type requestType, string allowedVerbs,
                              IEnumerable <RouteNamingConventionDelegate> routeNamingConventions = null)
 {
     foreach (var strategy in routeNamingConventions ?? HostContext.AppHost?.Config.RouteNamingConventions ?? RouteNamingConvention.Default.ToList())
     {
         strategy(routes, requestType, allowedVerbs);
     }
 }
Beispiel #11
0
 public void Init(
     Container container,
     IList <IPlugin> plugins,
     IServiceRoutes routes,
     EndpointHostConfig endpointHostconfig
     )
 {
 }
        private static void AddOldApiRoutes(IServiceRoutes routes, Assembly assembly)
        {
            var services = assembly.GetExportedTypes()
                           .Where(t => !t.IsAbstract &&
                                  t.IsSubclassOfRawGeneric(typeof(ServiceBase <>)));

            foreach (Type service in services)
            {
                Type baseType = service.BaseType;
                //go up the hierarchy to the first generic base type
                while (!baseType.IsGenericType)
                {
                    baseType = baseType.BaseType;
                }

                Type requestType = baseType.GetGenericArguments()[0];

                string allowedVerbs = null; //null == All Routes

                if (service.IsSubclassOfRawGeneric(typeof(RestServiceBase <>)))
                {
                    //find overriden REST methods
                    var allowedMethods = new List <string>();
                    if (service.GetMethod("OnGet").DeclaringType == service)
                    {
                        allowedMethods.Add(HttpMethods.Get);
                    }

                    if (service.GetMethod("OnPost").DeclaringType == service)
                    {
                        allowedMethods.Add(HttpMethods.Post);
                    }

                    if (service.GetMethod("OnPut").DeclaringType == service)
                    {
                        allowedMethods.Add(HttpMethods.Put);
                    }

                    if (service.GetMethod("OnDelete").DeclaringType == service)
                    {
                        allowedMethods.Add(HttpMethods.Delete);
                    }

                    if (service.GetMethod("OnPatch").DeclaringType == service)
                    {
                        allowedMethods.Add(HttpMethods.Patch);
                    }

                    if (allowedMethods.Count == 0)
                    {
                        continue;
                    }
                    allowedVerbs = string.Join(" ", allowedMethods.ToArray());
                }

                routes.AddRoute(requestType, allowedVerbs);
            }
        }
        /// <summary>
        ///     Scans the supplied Assemblies to infer REST paths and HTTP verbs.
        /// </summary>
        ///<param name="routes">The <see cref="IServiceRoutes"/> instance.</param>
        ///<param name="assembliesWithServices">
        ///     The assemblies with REST services.
        /// </param>
        /// <returns>The same <see cref="IServiceRoutes"/> instance;
        ///		never <see langword="null"/>.</returns>
        public static IServiceRoutes AddFromAssembly(this IServiceRoutes routes, params Assembly[] assembliesWithServices)
        {
            foreach (Assembly assembly in assembliesWithServices)
            {
                AddNewApiRoutes(routes, assembly);
            }

            return(routes);
        }
        /// <summary>
        ///     Scans the supplied Assemblies to infer REST paths and HTTP verbs.
        /// </summary>
        ///<param name="routes">The <see cref="IServiceRoutes"/> instance.</param>
        ///<param name="assembliesWithServices">
        ///     The assemblies with REST services.
        /// </param>
        /// <returns>The same <see cref="IServiceRoutes"/> instance;
        ///		never <see langword="null"/>.</returns>
        public static IServiceRoutes AddFromAssembly(this IServiceRoutes routes,
                                                     params Assembly[] assembliesWithServices)
        {
            foreach (Assembly assembly in assembliesWithServices)
            {
                IEnumerable <Type> restServices =
                    from t in assembly.GetExportedTypes()
                    where
                    !t.IsAbstract &&
                    t.IsSubclassOfRawGeneric(typeof(RestServiceBase <>))
                    select t;

                foreach (Type restService in restServices)
                {
                    Type baseType = restService.BaseType;

                    //go up the hierarchy to the first generic base type
                    while (!baseType.IsGenericType)
                    {
                        baseType = baseType.BaseType;
                    }

                    Type requestType = baseType.GetGenericArguments()[0];

                    //find overriden REST methods
                    string allowedMethods = "";
                    if (restService.GetMethod("OnGet").DeclaringType == restService)
                    {
                        allowedMethods += "GET ";
                    }

                    if (restService.GetMethod("OnPost").DeclaringType == restService)
                    {
                        allowedMethods += "POST ";
                    }

                    if (restService.GetMethod("OnPut").DeclaringType == restService)
                    {
                        allowedMethods += "PUT ";
                    }

                    if (restService.GetMethod("OnDelete").DeclaringType == restService)
                    {
                        allowedMethods += "DELETE ";
                    }

                    if (restService.GetMethod("OnPatch").DeclaringType == restService)
                    {
                        allowedMethods += "PATCH ";
                    }

                    routes.Add(requestType, restService.Name, allowedMethods, null);
                }
            }

            return(routes);
        }
        /// <summary>
        /// The configure routes.
        /// </summary>
        /// <param name="routes">
        /// The routes.
        /// </param>
        public virtual void ConfigureRoutes(IServiceRoutes routes)
        {
            routes.Add<NewsRequest>("/" + SiteIdToken + this.GetNewsServiceRestPath());
            routes.Add<NewsRequest>("/" + SiteIdToken + this.GetNewsByIdNewsServiceRestPath());
            routes.Add<NewsRequest>("/" + SiteIdToken + this.GetNewsByCategoryIdNewsServiceRestPath());

            routes.Add<NewsRequest>(this.GetNewsServiceRestPath());
            routes.Add<NewsRequest>(this.GetNewsByIdNewsServiceRestPath());
            routes.Add<NewsRequest>(this.GetNewsByCategoryIdNewsServiceRestPath());
        }
Beispiel #16
0
        public static void WithMatchingPropertyNames(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithName = (from property in requestType.GetPublicProperties().Select(p => p.Name)
                                   from name in PropertyNamesToMatch
                                   where property.Equals(name, StringComparison.InvariantCultureIgnoreCase)
                                   select "{{{0}}}".Fmt(property)).ToList();

            if (membersWithName.Count == 0) return;

            membersWithName.Insert(0, "/{0}".Fmt(requestType.GetOperationName()));

            var restPath = membersWithName.Join("/");
            routes.Add(requestType, restPath: restPath, verbs: allowedVerbs, priority: AutoGenPriority);
        }
Beispiel #17
0
        public static void WithMatchingAttributes(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithAttribute = (from p in requestType.GetPublicProperties()
                                        let attributes = p.AllAttributes<Attribute>()
                                        where attributes.Any(a => AttributeNamesToMatch.Contains(a.GetType().GetOperationName()))
                                        select "{{{0}}}".Fmt(p.Name)).ToList();

            if (membersWithAttribute.Count == 0) return;

            membersWithAttribute.Insert(0, "/{0}".Fmt(requestType.GetOperationName()));

            var restPath = membersWithAttribute.Join("/");
            routes.Add(requestType, restPath: restPath, verbs: allowedVerbs, priority: AutoGenPriority);
        }
Beispiel #18
0
        private static void AddRoute(this IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            routes.Add(requestType, "/" + requestType.Name, allowedVerbs);

            var hasIdField = requestType.GetProperty(IdUtils.IdField) != null;

            if (!hasIdField)
            {
                return;
            }

            var routePath = "/" + requestType.Name + "/{" + IdUtils.IdField + "}";

            routes.Add(requestType, routePath, allowedVerbs);
        }
Beispiel #19
0
        public static void WithMatchingAttributes(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithAttribute = (from p in requestType.GetPublicProperties()
                                        let attributes = p.AllAttributes <Attribute>()
                                                         where attributes.Any(a => AttributeNamesToMatch.Contains(a.GetType().GetOperationName()))
                                                         select $"{{{p.Name}}}").ToList();

            if (membersWithAttribute.Count == 0)
            {
                return;
            }

            membersWithAttribute.Insert(0, $"/{requestType.GetOperationName()}");

            var restPath = membersWithAttribute.Join("/");

            routes.Add(requestType, restPath: restPath, verbs: allowedVerbs, priority: AutoGenPriority);
        }
Beispiel #20
0
        public static void WithMatchingPropertyNames(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithName = (from property in requestType.GetPublicProperties().Select(p => p.Name)
                                   from name in PropertyNamesToMatch
                                   where property.Equals(name, StringComparison.OrdinalIgnoreCase)
                                   select $"{{{property}}}").ToList();

            if (membersWithName.Count == 0)
            {
                return;
            }

            membersWithName.Insert(0, $"/{requestType.GetOperationName()}");

            var restPath = membersWithName.Join("/");

            routes.Add(requestType, restPath: restPath, verbs: allowedVerbs, priority: AutoGenPriority);
        }
Beispiel #21
0
        /// <summary>With matching attributes.</summary>
        ///
        /// <param name="routes">      The routes.</param>
        /// <param name="requestType"> Type of the request.</param>
        /// <param name="allowedVerbs">The allowed verbs.</param>
        public static void WithMatchingAttributes(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithAttribute = (from p in requestType.GetPublicProperties()
                                        let attributes = p.CustomAttributes(inherit: false).Cast <Attribute>()
                                                         where attributes.Any(a => AttributeNamesToMatch.Contains(a.GetType().Name))
                                                         select "{{{0}}}".Fmt(p.Name)).ToList();

            if (membersWithAttribute.Count == 0)
            {
                return;
            }

            membersWithAttribute.Insert(0, "/{0}".Fmt(requestType.Name));

            var restPath = membersWithAttribute.Join("/");

            routes.Add(requestType, restPath: restPath, verbs: allowedVerbs);
        }
Beispiel #22
0
        /// <summary>With matching property names.</summary>
        ///
        /// <param name="routes">      The routes.</param>
        /// <param name="requestType"> Type of the request.</param>
        /// <param name="allowedVerbs">The allowed verbs.</param>
        public static void WithMatchingPropertyNames(IServiceRoutes routes, Type requestType, string allowedVerbs)
        {
            var membersWithName = (from property in requestType.GetPublicProperties().Select(p => p.Name)
                                   from name in PropertyNamesToMatch
                                   where property.Equals(name, StringComparison.InvariantCultureIgnoreCase)
                                   select "{{{0}}}".Fmt(property)).ToList();

            if (membersWithName.Count == 0)
            {
                return;
            }

            membersWithName.Insert(0, "/{0}".Fmt(requestType.Name));

            var restPath = membersWithName.Join("/");

            routes.Add(requestType, restPath: restPath, verbs: allowedVerbs);
        }
 public static void Register(IServiceRoutes serviceRoutes)
 {
     serviceRoutes
         .Add<GetSupportedServicesRequest>(RestPaths.SupportedServices)
         .Add<GetRegistrationHtmlRequest>(RestPaths.RegistrationHtml)
         .Add<IsRegisteredForServiceRequest>(RestPaths.IsRegistered)
         .Add<GetServiceTokenForPrincipalIdRequest>(RestPaths.ServiceProviderToken)
         .Add<RegisterServiceTokenRequest>(RestPaths.ReceivedToken)
         .Add<RegisterServiceProviderRequest>(RestPaths.ReceivedServiceProvider)
         .Add<BrowseApplicationsRequest>(RestPaths.Applications)
         .Add<GetApplicationRequest>(RestPaths.Application, "GET")
         .Add<AddApplicationRequest>(RestPaths.Application, "PUT")
         .Add<DeleteApplicationRequest>(RestPaths.Application, "DELETE")
         .Add<BrowseApplicationServicesRequest>(RestPaths.ApplicationServices)
         .Add<AddApplicationServiceRequest>(RestPaths.ApplicationServices, "PUT")
         .Add<DeleteApplicationServiceRequest>(RestPaths.ApplicationServices, "DELETE")
         .Add<RegisterAccountRequest>(RestPaths.RegisterAccount, "POST")
         .Add<RegisterAccountUserRequest>(RestPaths.RegisterUser, "POST")
         .Add<BrowseAccountUsersRequest>(RestPaths.AccountUsers, "GET")
         .Add<GetUserRequest>(RestPaths.AccountUser, "GET");
 }
Beispiel #24
0
        public void Init(
            Container container,
            IList <IPlugin> plugins,
            IServiceRoutes routes,
            EndpointHostConfig endpointHostconfig
            )
        {
            LogManager.LogFactory = new NLogFactory();

            //Configure User Defined REST Paths
            //Routes
            //  .Add<Hello>("/hello")
            //  .Add<Hello>("/hello/{Name*}");

            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            setPlugins(plugins);

            registerDependencies(container);

            setEndpointHostConfig(endpointHostconfig);
        }
Beispiel #25
0
        public void Init(
            Container container, 
            IList<IPlugin> plugins, 
            IServiceRoutes routes,
            EndpointHostConfig endpointHostconfig
            )
        {
            LogManager.LogFactory = new NLogFactory();

            //Configure User Defined REST Paths
            //Routes
            //  .Add<Hello>("/hello")
            //  .Add<Hello>("/hello/{Name*}");

            //Set JSON web services to return idiomatic JSON camelCase properties
            ServiceStack.Text.JsConfig.EmitCamelCaseNames = true;

            setPlugins(plugins);

            registerDependencies(container);

            setEndpointHostConfig(endpointHostconfig);
        }
Beispiel #26
0
 public static IServiceRoutes Add <T>(this IServiceRoutes serviceRoutes, string restPath, ApplyTo verbs, params Expression <Func <T, object> >[] propertyExpressions)
 {
     return(serviceRoutes.Add <T>(FormatRoute(restPath, propertyExpressions), verbs));
 }
Beispiel #27
0
 public static void WithRequestDtoName(IServiceRoutes routes, Type requestType, string allowedVerbs)
 {
     routes.Add(requestType, restPath: "/{0}".Fmt(requestType.GetOperationName()), verbs: allowedVerbs, priority:AutoGenPriority);
 }
 public static IServiceRoutes Add(this IServiceRoutes routes, Type requestType, string path, ApplyTo applyTo)
 {
     return(routes.Add(new RestPath(requestType, path, applyTo.ToVerbsString())));
 }
Beispiel #29
0
 public static IServiceRoutes Add <TRequest>(this IServiceRoutes routes, string restPath, ApplyTo verbs)
 {
     return(routes.Add <TRequest>(restPath, verbs.ToVerbsString()));
 }
 public static void WithRequestDtoName(IServiceRoutes routes, Type requestType, string allowedVerbs)
 {
     routes.Add(requestType, restPath: "/{0}".Fmt(requestType.Name), verbs: allowedVerbs);
 }
Beispiel #31
0
 public static void WithRequestDtoName(IServiceRoutes routes, Type requestType, string allowedVerbs)
 {
     routes.Add(requestType, restPath: "/{0}".Fmt(requestType.GetOperationName()), verbs: allowedVerbs, priority: AutoGenPriority);
 }
        /// <summary>
        ///     Scans the supplied Assemblies to infer REST paths and HTTP verbs.
        /// </summary>
        ///<param name="routes">The <see cref="IServiceRoutes"/> instance.</param>
        ///<param name="assembliesWithServices">
        ///     The assemblies with REST services.
        /// </param>
        /// <returns>The same <see cref="IServiceRoutes"/> instance;
        ///		never <see langword="null"/>.</returns>
        public static IServiceRoutes AddFromAssembly(this IServiceRoutes routes,
                                                     params Assembly[] assembliesWithServices)
        {
            foreach (Assembly assembly in assembliesWithServices)
            {
                IEnumerable <Type> services =
                    from t in assembly.GetExportedTypes()
                    where
                    !t.IsAbstract &&
                    t.IsSubclassOfRawGeneric(typeof(ServiceBase <>))
                    select t;

                foreach (Type service in services)
                {
                    Type baseType = service.BaseType;
                    //go up the hierarchy to the first generic base type
                    while (!baseType.IsGenericType)
                    {
                        baseType = baseType.BaseType;
                    }

                    Type requestType = baseType.GetGenericArguments()[0];

                    string allowedVerbs = null; //null == All Routes

                    if (service.IsSubclassOfRawGeneric(typeof(RestServiceBase <>)))
                    {
                        //find overriden REST methods
                        var allowedMethods = new List <string>();
                        if (service.GetMethod("OnGet").DeclaringType == service)
                        {
                            allowedMethods.Add(HttpMethods.Get);
                        }

                        if (service.GetMethod("OnPost").DeclaringType == service)
                        {
                            allowedMethods.Add(HttpMethods.Post);
                        }

                        if (service.GetMethod("OnPut").DeclaringType == service)
                        {
                            allowedMethods.Add(HttpMethods.Put);
                        }

                        if (service.GetMethod("OnDelete").DeclaringType == service)
                        {
                            allowedMethods.Add(HttpMethods.Delete);
                        }

                        if (service.GetMethod("OnPatch").DeclaringType == service)
                        {
                            allowedMethods.Add(HttpMethods.Patch);
                        }

                        if (allowedMethods.Count == 0)
                        {
                            continue;
                        }
                        allowedVerbs = string.Join(" ", allowedMethods.ToArray());
                    }

                    routes.Add(requestType, requestType.Name, allowedVerbs);

                    var hasIdField = requestType.GetProperty(IdUtils.IdField) != null;
                    if (hasIdField)
                    {
                        var routePath = requestType.Name + "/{" + IdUtils.IdField + "}";
                        routes.Add(requestType, routePath, allowedVerbs);
                    }
                }
            }

            return(routes);
        }
Beispiel #33
0
 /// <summary>
 /// Configure service stack web api routes
 /// </summary>
 /// <param name="routes"></param>
 public static void ConfigureServiceRoutes(IServiceRoutes routes)
 {
     //routes.Add<YM.Service.SlideRequest>("/slide");
 }
 public static IServiceRoutes Add <TRequest>(this IServiceRoutes routes, string path, string verbs)
 {
     return(routes.Add(new RestPath(typeof(TRequest), path, verbs)));
 }
Beispiel #35
0
 public static IServiceRoutes Add <TRequest>(this IServiceRoutes routes, string restPath, ApplyTo verbs, string defaultContentType)
 {
     return(routes.Add <TRequest>(restPath, verbs.ToVerbsString(), defaultContentType));
 }
Beispiel #36
0
 /// <summary>
 /// Configure service stack web api routes
 /// </summary>
 /// <param name="routes"></param>
 public static void ConfigureServiceRoutes(IServiceRoutes routes)
 {
     //routes.Add<YM.Service.SlideRequest>("/slide");
 }
Beispiel #37
0
 public static IServiceRoutes Add(this IServiceRoutes routes, Type requestType, string restPath, ApplyTo verbs)
 {
     return(routes.Add(requestType, restPath, verbs.ToVerbsString()));
 }
Beispiel #38
0
 /// <summary>With request dto name.</summary>
 ///
 /// <param name="routes">      The routes.</param>
 /// <param name="requestType"> Type of the request.</param>
 /// <param name="allowedVerbs">The allowed verbs.</param>
 public static void WithRequestDtoName(IServiceRoutes routes, Type requestType, string allowedVerbs)
 {
     routes.Add(requestType, restPath: "/{0}".Fmt(requestType.Name), verbs: allowedVerbs);
 }
 public static void Add <T>(this IServiceRoutes serviceRoutes, string httpMethod, string url, params Expression <Func <T, object> >[] propertyExpressions)
 {
     serviceRoutes.Add <T>(FormatRoute(url, propertyExpressions), httpMethod);
 }
 public static IServiceRoutes Add <TRequest>(this IServiceRoutes routes, string path, ApplyTo applyTo)
 {
     return(routes.Add(new RestPath(typeof(TRequest), path, applyTo.ToVerbsString())));
 }
 public static void Define(IServiceRoutes routes)
 {
 }
Beispiel #42
0
 public static IServiceRoutes Add <T>(this IServiceRoutes routes, string restPath, string verbs, string summary, string notes)
 {
     return(routes.Add(typeof(T), restPath, verbs, summary, notes));
 }