示例#1
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");
            }
        }