我正在使用在Windows XP上运行的msysgit.
尝试Ctrl+ V,右键单击,中键单击,谷歌...没有运气.
对于一个场景,我有一个ASP.NET MVC应用程序,其URL如下所示:
http://example.com/Customer/List
http://example.com/Customer/List/Page/2
http://example.com/Customer/List
http://example.com/Customer/View/8372
http://example.com/Customer/Search/foo/Page/5
Run Code Online (Sandbox Code Playgroud)
这些URL通过以下路由实现 Global.asax.cs
routes.MapRoute(
"CustomerSearch"
, "Customer/Search/{query}/Page/{page}"
, new { controller = "Customer", action = "Search" }
);
routes.MapRoute(
"CustomerGeneric"
, "Customer/{action}/{id}/Page/{page}"
, new { controller = "Customer" }
);
//-- Default Route
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Customer", action = "Index", id = "" }
);
Run Code Online (Sandbox Code Playgroud)
这些都进展顺利,直到新的要求到达并希望从URL中删除关键字"客户",以使URL看起来像:
http://example.com/List
http://example.com/List/Page/2
http://example.com/List
http://example.com/View/8372
http://example.com/Search/foo/Page/5
Run Code Online (Sandbox Code Playgroud)
编辑:更正了示例链接,感谢@haacked.
我尝试添加new MapRoutes以{action}仅采用并将默认控制器设置为Customer.例如/
routes.MapRoute(
"CustomerFoo"
, "{action}"
, new { controller = "Customer", action = …Run Code Online (Sandbox Code Playgroud) 我正在尝试将以下slugify方法从PHP转换为C#:http://snipplr.com/view/22741/slugify-a-string-in-php/
编辑:为方便起见,这里是上面的代码:
/**
* Modifies a string to remove al non ASCII characters and spaces.
*/
static public function slugify($text)
{
// replace non letter or digits by -
$text = preg_replace('~[^\\pL\d]+~u', '-', $text);
// trim
$text = trim($text, '-');
// transliterate
if (function_exists('iconv'))
{
$text = iconv('utf-8', 'us-ascii//TRANSLIT', $text);
}
// lowercase
$text = strtolower($text);
// remove unwanted characters
$text = preg_replace('~[^-\w]+~', '', $text);
if (empty($text))
{
return 'n-a';
}
return $text;
}
Run Code Online (Sandbox Code Playgroud)
除了我找不到以下PHP代码行的C#等价物之外,我没有遇到任何问题.
$text = …Run Code Online (Sandbox Code Playgroud) 许多人在他们的头脑中有可能吸引数百万的在线创业公司,但大多数时候你只有最低的预算(时间和资源),所以你想在一年的时间内交付它.启动后不久,您必须执行一个或一系列升级,其中可能包括:更新基础的代码重构,在软件架构中添加层次结构或重组数据库.这个升级/重构循环继续如下:
以上述为先决条件,我想认真对待这个讨论,并确定Web应用程序可升级解决方案的本质.在讨论中,您可以讨论任何开发阶段(初始,早期升级,增量升级),并涵盖以下其中一项:
环境:
NodeJS 8.1.2
axios 0.16.2
axios-mock-adapter 1.9.0
Run Code Online (Sandbox Code Playgroud)
使用JSONPlaceholder的测试 POST API 调用如下:
const expect = require('chai').expect
const MockAdapter = require('axios-mock-adapter')
// Bootstrapping
const PlaceholderApp = {
createComment: function (author, email, message) {
const options = {
method: 'post',
url: 'https://jsonplaceholder.typicode.com/comments',
data: {
name: author,
email: email,
body: message,
}
}
return axios(options)
}
}
// Mock Adapter
const mockHttpClient = new MockAdapter(axios, { delayResponse: 50 })
// mockHttpClient.onPost(/(\/comments)/i, { name: 'author A', email: 'authorA@test.com', body: 'test comment' }).reply(526) // WORKS! …Run Code Online (Sandbox Code Playgroud) architecture ×1
asp.net-mvc ×1
axios ×1
c# ×1
copy-paste ×1
git ×1
javascript ×1
msysgit ×1
performance ×1
routing ×1
scalability ×1
slug ×1
windows-xp ×1