惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Apple Machine Learning Research
Apple Machine Learning Research
Help Net Security
Help Net Security
A
About on SuperTechFans
博客园_首页
M
MIT News - Artificial intelligence
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
量子位
F
Fortinet All Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
L
LINUX DO - 最新话题
The GitHub Blog
The GitHub Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cybersecurity and Infrastructure Security Agency CISA
N
News and Events Feed by Topic
S
Security @ Cisco Blogs
A
Arctic Wolf
V
Vulnerabilities – Threatpost
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
T
Tailwind CSS Blog
The Last Watchdog
The Last Watchdog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
H
Heimdal Security Blog
H
Hacker News: Front Page
Simon Willison's Weblog
Simon Willison's Weblog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recent Announcements
Recent Announcements
N
Netflix TechBlog - Medium
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
MyScale Blog
MyScale Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
AI
AI
L
LINUX DO - 热门话题
G
Google Developers Blog
P
Proofpoint News Feed
腾讯CDC
Schneier on Security
Schneier on Security
美团技术团队
V
V2EX
PCI Perspectives
PCI Perspectives
L
Lohrmann on Cybersecurity
Jina AI
Jina AI
博客园 - 司徒正美

博客园 - spdevelop

带有智能完成功能的万能查询分析器的开发心得 SpDevelop V3.0发布 中国代码日志(www.Cnclog.com)正式开通! 数据实体层介绍 SpDevelop 数据库建模软件 终于把.Net的大部分开源项目整理出来 软件发布 SpDevelop混淆器(.Net版本) 计算机软件著作权登记办法 互联网著作权行政保护办法 GNU宣言 BSD许可问题 软件分类(自由软件、开放源代码软件、公共软件......) 有关开放源代码软件与商业软件知识产权的研究报告(上) 有关开放源代码软件与商业软件知识产权的研究报告(中) 有关开放源代码软件与商业软件知识产权的研究报告(下) 商业周刊:开源代码趋成熟 开源软件与商业软件知识产权报告全文 .net 技术站点
SpDevelop模版开发 之 Hello world - spdevelop
spdevelop · 2007-04-16 · via 博客园 - spdevelop

SpDevelop模版开发.

        创建好一个模板后第一步要指明这是一个C#语言的模板。

<%@ CodeTemplate Language="C#" ClassName="Test" TargetLanguage="C#"
      Description
="Generates a class including a special informational header" %>


        第二步,我们要指明模板在生成代码时的属性,即生成代码需要的输入值变量。

<%@ Property Name="NameSpace" Type="String"
      Category
="Context"
      Description
="The namespace to use for this class" %>

        如上边所示,在进行代码生成时,在SpDevelop中选择模板后生成代码的窗口中,变量的名称为NameSpace,类型是String,类别是Context,当用户选中这个属性时对于属性的描述Description。
        我们可以按照C#语言的语法去使用定义的变量,例如:

///////////////////////////////////////////////////////////////////////////////////////
// File: <%=ClassName%>.cs


        例如下面这个例子模板使用了上面介绍的知识。Test.cst

<%@ CodeTemplate Language="C#"  ClassName="Test"  TargetLanguage="C#"
      Description
="Generates a class including a special informational header" %>
 
<%@ Property Name="NameSpace" Type="String"
      Category
="Context"
      Description
="The namespace to use for this class" %>
 
<%@ Property Name="ClassName" Type="String"
      Category
="Context"
      Description
="The name of the class to generate" %>
 
<%@ Property Name="DevelopersName" Type="String"
      Category
="Context"
      Description
="The name to include in the comment header" %>

///////////////////////////////////////////////////////////////////////////////////////
// File: <%=ClassName%>.cs
// Description: Enter summary here after generation.
// ---------------------
// Copyright © <%= DateTime.Now.Year %> Our Client
// ---------------------
// History
//    <%= DateTime.Now.ToShortDateString() %>    <%= DevelopersName%>    Original Version
///////////////////////////////////////////////////////////////////////////////////////
 
using System;
 
namespace <%=NameSpace %>
{
     
/// <summary>
     
/// Summary description for <%=ClassName %>.
     
/// </summary>
      public class <%=ClassName %>
      {
           
public <%=ClassName %>()
            {
                 
//
                 
// TODO: Add constructor logic here
                 
//
            }
      }
}

具体操作说明:

1、打开SpDevelop,新建一个Template项目,命令为HelloWorld。

 

2、将上面的Test.cst的内容拷贝到main.cst中

3、在解决方案中,右击"HelloWorld"项目,依次执行"编译"和"生成"操作

 

4、在生成后,工作区中将自动打开生成的窗体.

 

先在左边的树型菜单中选中您要生成的模版(例如1),填入要生成的目标属性(比如2),

接着填写生成的目标输出路径,点击生成即可看见生成的结果

 1///////////////////////////////////////////////////////////////////////////////////////
 2// File: MyClass.cs
 3// Description: Enter summary here after generation.
 4// ---------------------
 5// Copyright © 2003 Our Client
 6// ---------------------
 7// History
 8//    12/2/2003    Mr. Smith    Original Version
 9///////////////////////////////////////////////////////////////////////////////////////
10 
11using System;
12 
13namespace MyNameSpace
14{
15        /// <summary>
16        /// Summary description for MyClass.
17        /// </summary>

18      public class MyClass
19        {
20                  public MyClass()
21                  {
22                          //
23                          // TODO: Add constructor logic here
24                          //
25            }

26        }

27}


生成后的代码即可放入Visual Studio .NET中使用,我们使用SpDevelop的目的就是为了快速高效的开发。