.net core 用户代码片段
作者:互联网
{
"Controller template": {
"prefix": "!controller",
"body": [
"using Microsoft.AspNetCore.Mvc;",
"",
"namespace ${WORKSPACE_NAME}.${RELATIVE_FILEPATH/\\\\[^\\\\]+$//i};",
"",
"public class ${TM_FILENAME_BASE} : Controller",
"{",
" private readonly ILogger<${TM_FILENAME_BASE}> _logger;$0",
"",
" public ${TM_FILENAME_BASE}(ILogger<${TM_FILENAME_BASE}> logger)",
" {",
" _logger = logger;",
" }",
"",
" public IActionResult Index()",
" {",
" return View();",
" }",
"}"
],
"description": "a controller template"
},
"Service template": {
"prefix": "!service",
"body": [
"namespace ${WORKSPACE_NAME}.${RELATIVE_FILEPATH/\\\\[^\\\\]+$//i};",
"",
"public class ${TM_FILENAME_BASE}",
"{",
" private readonly IRepository _repository;$0",
"",
" public ${TM_FILENAME_BASE}(IRepository repository)",
" {",
" _repository = repository;",
" }",
"",
"}"
],
"description": "a service template"
},
"Entity template": {
"prefix": "!entity",
"body": [
"namespace ${WORKSPACE_NAME}.${RELATIVE_FILEPATH/\\\\[^\\\\]+$//i};",
"",
"/// <summary>",
"/// ${TM_FILENAME_BASE}",
"/// </summary>",
"[Table(\"$0\")]",
"public class ${TM_FILENAME_BASE} : BaseEntity",
"{",
"",
" /// <summary>",
" /// 创建人",
" /// </summary>",
" public Guid? CreateUserId { get; set; }",
" /// <summary>",
" /// 创建时间",
" /// </summary>",
" public DateTime? CreateTime { get; set; }",
" /// <summary>",
" /// 修改人",
" /// </summary>",
" public Guid? ModifyUserId { get; set; }",
" /// <summary>",
" /// 修改时间",
" /// </summary>",
" public DateTime? ModifyTime { get; set; }",
"}"
],
"description": "a entity template"
}
}
标签:core,片段,set,FILENAME,BASE,TM,template,net,public 来源: https://www.cnblogs.com/rossing/p/16685472.html