⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csproj.cs

📁 客户关系管理系统ASP.NET+VB.NET编程完整程序!
💻 CS
字号:
//This file is part of ORM.NET.
//
//ORM.NET is free software; you can redistribute it and/or
//modify it under the terms of the GNU Lesser General Public
//License as published by the Free Software Foundation; either
//version 2.1 of the License, or (at your option) any later version.
//
//ORM.NET is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//Lesser General Public License for more details.
//
//You should have received a copy of the GNU Lesser General Public
//License along with ORM.NET; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


using System;
using System.Text;
using OrmLib;
using ORMBiz;

namespace ORM.NET
{
	/// <summary>
	/// Summary description for CsProjGenerator.
	/// </summary>
	public class CsProjGenerator
	{
		private TemplateParser tp = new TemplateParser();
		private StringBuilder sb;

		public CsProjGenerator(){}

		public string Generate(Database db)
		{
			// this is calculated from multiple databases:
			// all were 95 per table
			sb = new StringBuilder(db.Tables.Count * 96);
			string output = RenderPage(db);

			//System.Diagnostics.Debug.WriteLine("StringBuilder Size=" + sb.Length);
			//System.Diagnostics.Debug.WriteLine("Database Tables=" + db.Tables.Count);

			return tp.RestoreAfterFormatting( output );
		}

		private string RenderPage(Database db)
		{
			string classString = tp.LoadTemplate(@"Biz\CsProj\csproj");

			return string.Format( classString,Shared.NameSpace, GetIncludeFileStatements(db), db.DatabaseToken );
		}

		private string GetIncludeFileStatements(Database db)
		{
			string file = tp.LoadTemplate(@"Biz\CsProj\file");
			//string code = "";

			foreach ( Table t in db.Tables )
			{
				if ( t.GenerateCodeFor.ToLower() == "true" )
				{
					sb.AppendFormat(file,t.AccessorName);
					//code += string.Format(file,t.AccessorName);
				}
			}

			//return code;
			return sb.ToString();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -