diff --git a/CodeSmith/CSharp/Web/Index.cshtml.1.cst b/CodeSmith/CSharp/Web/Index.cshtml.1.cst
deleted file mode 100644
index d2a7c4c2..00000000
--- a/CodeSmith/CSharp/Web/Index.cshtml.1.cst
+++ /dev/null
@@ -1,105 +0,0 @@
-<%--
-Name: 列表页面
-Author: yubaolee
-Description: 列表页面
---%>
-<%@ CodeTemplate Language="C#" TargetLanguage="C#" Debug="False" Encoding="utf-8" Description="添加模块" %>
-<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context"
-Description="连接的数据库" %>
-<%@ Property Name="ModuleName" Type="String" Category="Context" Description="模块名称" %>
-<%@ Map Name="CSharpAlias" Src="System-CSharpAlias" Description="System to C# Type Map" %>
-<%@ Assembly Name="SchemaExplorer" %>
-<%@ Import Namespace="SchemaExplorer" %>
-<%@ Assembly Src="Util.cs" %>
-<%@ Import Namespace="Util" %>
-@{
- Layout = "~/Views/Shared/_BjuiLayout.cshtml";
-}
-
-@{ Html.RenderAction("MenuHeader", "Home");}
-
-
-
-
-
-
-
-
-
diff --git a/CodeSmith/CSharp/Web/Index.cshtml.cst b/CodeSmith/CSharp/Web/Index.cshtml.cst
index 99e232d5..628af601 100644
--- a/CodeSmith/CSharp/Web/Index.cshtml.cst
+++ b/CodeSmith/CSharp/Web/Index.cshtml.cst
@@ -100,6 +100,6 @@ Description="连接的数据库" %>
-
+
diff --git a/CodeSmith/CSharp/WebGenerate.cst b/CodeSmith/CSharp/WebGenerate.cst
index d8b00750..f294d04a 100644
--- a/CodeSmith/CSharp/WebGenerate.cst
+++ b/CodeSmith/CSharp/WebGenerate.cst
@@ -34,7 +34,6 @@ Description="连接的数据库" %>
<%@ Property Name="NeedViewModel"
Type="Boolean"
- Category="5.Customization"
Default="False"
Optional="True"
Description="是否需要ViewModel" %>
@@ -46,6 +45,9 @@ Description="连接的数据库" %>
<%@ Register Name="HtmlGenerateClass"
Template="Web\Index.cshtml.cst"
MergeProperties="False" %>
+<%@ Register Name="JSGenerateClass"
+ Template="Web\index.js.cst"
+ MergeProperties="False" %>
Generating Entities ...
<% Generate(); %>
@@ -58,14 +60,18 @@ Generating Entities ...
if (!Directory.Exists(directory)) //根目录
Directory.CreateDirectory(directory);
- if (!Directory.Exists(directory +"/views")) //视图根文件夹
+ if (!Directory.Exists(directory +"/views")) //视图根文件夹
Directory.CreateDirectory(directory +"/views");
+
+ if (!Directory.Exists(directory +"/js")) //js根目录
+ Directory.CreateDirectory(directory +"/js");
- if (!Directory.Exists(directory +"/views/"+ModuleName)) //视图文件夹
- Directory.CreateDirectory(directory +"/views/"+ModuleName);
+ if (!Directory.Exists(directory +"/views/"+ModuleName +"Manager")) //视图文件夹
+ Directory.CreateDirectory(directory +"/views/"+ModuleName +"Manager");
CreateApplicationClass();
CreateHtmlClass();
+ CreateJSClass();
this.RegisterReference("System.Configuration");
this.RegisterReference("System.Data");
@@ -77,7 +83,7 @@ Generating Entities ...
Response.WriteLine("Generate Time: " + watch.ElapsedMilliseconds + " ms");
}
- //创建APP层
+ //创建APP层,如UserApp.cs
public void CreateApplicationClass()
{
ApplicationGenerateClass generatedClass = this.Create();
@@ -95,13 +101,13 @@ Generating Entities ...
generatedClass.RenderToFile(generatedFile, generatedFile, true);
}
- //创建视图
+ //创建视图,如views/Users/index.html
public void CreateHtmlClass()
{
HtmlGenerateClass generatedClass = this.Create();
this.CopyPropertiesTo(generatedClass);
- generatedFile = Path.GetFullPath(directory) + "/views/"+ModuleName+"/" + "index.cshtml";
+ string generatedFile = Path.GetFullPath(directory) + "/views/"+ModuleName+"Manager/" + "index.cshtml";
generatedClass.ModuleName = ModuleName;
generatedClass.SourceTable = SourceTable;
@@ -110,6 +116,19 @@ Generating Entities ...
generatedClass.RenderToFile(generatedFile, generatedFile, true);
}
+ //创建视图,如js/userManager.js
+ public void CreateJSClass()
+ {
+ JSGenerateClass generatedClass = this.Create();
+ this.CopyPropertiesTo(generatedClass);
+ string generatedFile = Path.GetFullPath(directory) + "/js/"+ModuleName+"Manager.js";
+
+ generatedClass.ModuleName = ModuleName;
+ generatedClass.SourceTable = SourceTable;
+
+ Response.WriteLine(generatedFile);
+ generatedClass.RenderToFile(generatedFile, generatedFile, true);
+ }
\ No newline at end of file