SqlHelper.cst 生成sql处理类
1
<%--
2
Name:
3
Author:
4
Description:
5
--%>
6
<%@ CodeTemplate Language="C#" ResponseEncoding="UTF-8" TargetLanguage="Text" Src="" Inherits="" Debug="False" Description="Template description here." %>
7
<%@ Property Name="NameSpace" Type="System.String" Default="" Optional="true" Category="命名空间" Description="当前生成实体类的命名空间" %>
8
<%@ Assembly Name="System.Data" %>
9
<%@ Import Namespace="System.Data" %>
10![]()
11![]()
12
using System;
13
using System.Data;
14
using System.Data.Sql;
15
using System.Data.SqlClient;
16
using System.Collections.Generic;
17
using System.Text;
18
using System.Configuration;
19
using System.Globalization;
20![]()
21![]()
22
namespace <%= NameSpace%>.Providers
23
{
24
/// <summary>
25
/// SqlHelper
26
/// </summary>
27
public static partial class SqlHelper
28
{
29
/// <summary>
30
/// 准备SqlCommand
31
/// </summary>
32
/// <param name="commandText"> 存储过程名 </param>
33
/// <param name="parameters"> 参数集 </param>
34
/// <param name="conn"> 数据连接对象 </param>
35
/// <returns> SqlCommand </returns>
36
public static SqlCommand PrepareCommand(string commandText, SqlConnection conn, CommandType commandType)
37
{
38
SqlCommand cmd = new SqlCommand();
39
cmd.Connection = conn;
40
cmd.CommandType = commandType;
41
cmd.CommandText = commandText;
42
43
return cmd;
44
}
45![]()
46
SQL参数生成:static MakeInParam,static MakeOutParam
108
}
109
}
110![]()
111
<script runat="template">
112
// My methods here.
113![]()
114
public string SampleMethod()
115
{
116
return "Method output.";
117
}
118
</script>
<%-- 2
Name:3
Author: 4
Description: 5
--%>6
<%@ CodeTemplate Language="C#" ResponseEncoding="UTF-8" TargetLanguage="Text" Src="" Inherits="" Debug="False" Description="Template description here." %>7
<%@ Property Name="NameSpace" Type="System.String" Default="" Optional="true" Category="命名空间" Description="当前生成实体类的命名空间" %>8
<%@ Assembly Name="System.Data" %>9
<%@ Import Namespace="System.Data" %>10

11

12
using System;13
using System.Data;14
using System.Data.Sql;15
using System.Data.SqlClient;16
using System.Collections.Generic;17
using System.Text;18
using System.Configuration;19
using System.Globalization;20

21

22
namespace <%= NameSpace%>.Providers23
{24
/// <summary>25
/// SqlHelper26
/// </summary>27
public static partial class SqlHelper28
{29
/// <summary>30
/// 准备SqlCommand31
/// </summary>32
/// <param name="commandText"> 存储过程名 </param>33
/// <param name="parameters"> 参数集 </param>34
/// <param name="conn"> 数据连接对象 </param>35
/// <returns> SqlCommand </returns>36
public static SqlCommand PrepareCommand(string commandText, SqlConnection conn, CommandType commandType)37
{38
SqlCommand cmd = new SqlCommand();39
cmd.Connection = conn;40
cmd.CommandType = commandType;41
cmd.CommandText = commandText;42
43
return cmd;44
}45

46
SQL参数生成:static MakeInParam,static MakeOutParam108
}109
}110

111
<script runat="template">112
// My methods here.113

114
public string SampleMethod()115
{116
return "Method output.";117
}118
</script>


浙公网安备 33010602011771号