用ASP.NET写你自己的代码生成器(1)。
2024-07-10 13:01:54
供稿:网友
最近写实体类集合类控制类什么的太“类”了,因此就花了点时间写了个代码生成器,与大家共享!
frmmain.aspx
<%@ page language="c#" codebehind="frmmain.aspx.cs" autoeventwireup="false" inherits="web_test.frmmain" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
<head>
<title>frmmain</title>
<meta name="generator" content="microsoft visual studio 7.0">
<meta name="code_language" content="c#">
<meta name="vs_defaultclientscript" content="javascript">
<meta name="vs_targetschema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body ms_positioning="gridlayout">
<form id="frmmain" method="post" runat="server">
<asp:textbox id="txtservername" style="z-index: 101; left: 116px; position: absolute; top: 24px; design_time_lock: true" runat="server" font-size="10pt" design_time_lock="true">192.168.0.220</asp:textbox>
<asp:label id="label7" style="z-index: 112; left: 24px; position: absolute; top: 98px; design_time_lock: true" runat="server" width="79px" height="20px" font-size="10pt" design_time_lock="true">数据库列表</asp:label>
<asp:label id="label6" style="z-index: 111; left: 27px; position: absolute; top: 169px; design_time_lock: true" runat="server" width="53px" height="20px" font-size="10pt" design_time_lock="true" visible="false">字段名</asp:label>
<asp:label id="label5" style="z-index: 109; left: 27px; position: absolute; top: 135px; design_time_lock: true" runat="server" width="53px" height="20px" font-size="10pt" design_time_lock="true">表名</asp:label>
<asp:button id="button1" style="z-index: 107; left: 496px; position: absolute; top: 91px; design_time_lock: true" runat="server" width="102px" text="gettable" font-size="10pt" design_time_lock="true"></asp:button>
<asp:label id="label4" style="z-index: 106; left: 288px; position: absolute; top: 63px; design_time_lock: true" runat="server" width="79px" height="20px" font-size="10pt" design_time_lock="true">密码</asp:label>
<asp:label id="label2" style="z-index: 105; left: 25px; position: absolute; top: 61px; design_time_lock: true" runat="server" width="79px" height="20px" font-size="10pt" design_time_lock="true">用户名</asp:label>
<asp:label id="label1" style="z-index: 104; left: 25px; position: absolute; top: 28px; design_time_lock: true" runat="server" width="79px" height="20px" font-size="10pt" design_time_lock="true">服务器名</asp:label>
<asp:textbox id="txtpassword" style="z-index: 103; left: 376px; position: absolute; top: 60px; design_time_lock: true" runat="server" font-size="10pt" backcolor="transparent" forecolor="black" bordercolor="white" design_time_lock="true"></asp:textbox>
<asp:textbox id="txtusername" style="z-index: 102; left: 116px; position: absolute; top: 62px; design_time_lock: true" runat="server" font-size="10pt" design_time_lock="true">sa</asp:textbox>
<asp:dropdownlist id="dropdownlist1" style="z-index: 108; left: 115px; position: absolute; top: 135px; design_time_lock: true" runat="server" width="208px" autopostback="true" font-size="10pt" design_time_lock="true"></asp:dropdownlist>
<asp:dropdownlist id="dropdownlist2" style="z-index: 110; left: 115px; position: absolute; top: 171px; design_time_lock: true" runat="server" width="208px" height="28px" font-size="10pt" design_time_lock="true" visible="false"></asp:dropdownlist>
<asp:button id="button2" style="z-index: 113; left: 355px; position: absolute; top: 92px; design_time_lock: true" runat="server" width="107px" text="getdatabase" design_time_lock="true"></asp:button>
<asp:dropdownlist id="dropdownlist3" style="z-index: 114; left: 115px; position: absolute; top: 98px; design_time_lock: true" runat="server" width="207px" height="25px" design_time_lock="true"></asp:dropdownlist>
<asp:button id="button3" style="z-index: 115; left: 354px; position: absolute; top: 132px; design_time_lock: true" runat="server" width="110px" text="生 成" design_time_lock="true" visible="false"></asp:button>
<asp:textbox id="txtlayout" style="z-index: 117; left: 26px; position: absolute; top: 206px; design_time_lock: true" runat="server" width="619px" height="367px" textmode="multiline" backcolor="ivory" design_time_lock="true"></asp:textbox>
<asp:button id="button4" style="z-index: 118; left: 497px; position: absolute; top: 130px; design_time_lock: true" runat="server" height="25px" width="105px" text="实体类" design_time_lock="true"></asp:button>
<asp:button id="button5" style="z-index: 119; left: 355px; position: absolute; top: 171px; design_time_lock: true" runat="server" width="107px" text="test" height="25px" design_time_lock="true" visible="false"></asp:button>
<asp:button id="button6" style="z-index: 120; left: 499px; position: absolute; top: 171px; design_time_lock: true" runat="server" height="23px" width="105px" text="集合类" design_time_lock="true" visible="false"></asp:button>
</form>
</body>
</html>