寻求一个FL Studio 师傅
studio吧
全部回复
仅看楼主
level 1
LonelyTune 楼主
寻求一个FL Studio 师傅 有意者请留QQ 谢谢 
2009年03月16日 12点03分 1
level 0
<%@ CodeTemplate Language="C
#" TargetLanguage="C#
" Description="Call the DBClass and DBClassXml template" %>
<%@ Property Name="CurDB" Type="SchemaExplorer.DatabaseSchema" Category="Context" Description="????????." %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Assembly Name="System.Design" %>
<%@ Assembly Name="CodeSmith.CustomProperties" %>
<%@ Import Namespace="CodeSmith.CustomProperties" %>
<%@ Import Namespace="SchemaExplorer" %>
<%
GenEntity();
GenXml();
GenXmlSelf();
GenBLLClass();
GenBLLSelf();
%>

private string _xmlDirectory = String.Empty;
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))] 
[Optional]
[Category("Output")]
[Description("The directory to output the results to.")]
public string XmlDirectory 
{
get
{
// default to the directory that the template is located in
if (_xmlDirectory.Length == 0) return @"D:\ASPNET\CodeSmithResult\XML\";
return _xmlDirectory;
}
set
{
_xmlDirectory = value;

}
private string _xmlDirectorySelf = String.Empty;
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))] 
[Optional]
[Category("Output")]
[Description("The directory to output the results to.")]
public string XmlDirectorySelf 
{
get
{
// default to the directory that the template is located in
if (_xmlDirectorySelf.Length == 0) return @"D:\ASPNET\CodeSmithResult\XMLSelf\";
return _xmlDirectorySelf;
}
set
{
_xmlDirectorySelf = value;

}
private string _EntityDirectory = String.Empty;
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))] 
[Optional]
[Category("Output")]
[Description("The directory to output the results to.")]
public string EntityDirectory 
{
get
{
// default to the directory that the template is located in
if (_EntityDirectory.Length == 0) return @"D:\ASPNET\CodeSmithResult\Entity\";

2009年04月02日 08点04分 3
level 0

return _EntityDirectory;
}
set
{
_EntityDirectory = value;

}
private string _BLLClassDirectory = String.Empty;
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))] 
[Optional]
[Category("Output")]
[Description("The directory to output the results to.")]
public string BLLClassDirectory 
{
get
{
// default to the directory that the template is located in
if (_BLLClassDirectory.Length == 0) return @"D:\ASPNET\CodeSmithResult\BLL\";
return _BLLClassDirectory;
}
set
{
_BLLClassDirectory = value;

}
private string _BLLClassDirectorySelf = String.Empty;
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))] 
[Optional]
[Category("Output")]
[Description("The directory to output the results to.")]
public string BLLClassDirectorySelf 
{
get
{
// default to the directory that the template is located in
if (_BLLClassDirectorySelf.Length == 0) return @"D:\ASPNET\CodeSmithResult\BLLSelf\";
return _BLLClassDirectorySelf;
}
set
{
_BLLClassDirectorySelf = value;

}
public void GenEntity()
{
CodeTemplateCompiler compiler=new CodeTemplateCompiler(this.CodeTemplateInfo.DirectoryName+"GenEntity.cst");
compiler.Compile();
CodeTemplate template;
if(compiler.Errors.Count==0)
{
for(int i=0;i<CurDB.Tables.Count;i++)
{
if(CurDB.Tables[i].Name.ToLower()!="dtproperties")
{
template=compiler.CreateInstance();
TableSchema table=CurDB.Tables[i];
template.SetProperty("SourceTable",table);
template.SetProperty("FilePath",EntityDirectory);
template.Render(Console.Out);
}
}
}
}
public void GenXml()
{
CodeTemplateCompiler compiler=new CodeTemplateCompiler(this.CodeTemplateInfo.DirectoryName+"GenXML.cst");
compiler.Compile();
CodeTemplate template;
if(compiler.Errors.Count==0)
{
for(int i=0;i<CurDB.Tables.Count;i++)
{
if(CurDB.Tables[i].Name.ToLower()!="dtproperties")
{
template=compiler.CreateInstance();
TableSchema table=CurDB.Tables[i];
template.SetProperty("SourceTable",table);
//template.SetProperty("NameSpace","NSFramework.Domain");

2009年04月02日 08点04分 4
level 0
template.SetProperty("FilePath",XmlDirectory);
template.Render(Console.Out);
}
}
}
}
public void GenXmlSelf()
{
CodeTemplateCompiler compiler=new CodeTemplateCompiler(this.CodeTemplateInfo.DirectoryName+"GenXMLSelf.cst");
compiler.Compile();
CodeTemplate template;
if(compiler.Errors.Count==0)
{
for(int i=0;i<CurDB.Tables.Count;i++)
{
if(CurDB.Tables[i].Name.ToLower()!="dtproperties")
{
template=compiler.CreateInstance();
TableSchema table=CurDB.Tables[i];
template.SetProperty("SourceTable",table);
//template.SetProperty("NameSpace","NSFramework.Domain");
template.SetProperty("FilePath",XmlDirectorySelf);
template.Render(Console.Out);
}
}
}
}
public void GenBLLClass()
{
CodeTemplateCompiler compiler=new CodeTemplateCompiler(this.CodeTemplateInfo.DirectoryName+"GenBLLClass.cst");
compiler.Compile();
CodeTemplate template;
if(compiler.Errors.Count==0)
{
for(int i=0;i<CurDB.Tables.Count;i++)
{
if(CurDB.Tables[i].Name.ToLower()!="dtproperties")
{
template=compiler.CreateInstance();
TableSchema table=CurDB.Tables[i];
template.SetProperty("SourceTable",table);
template.SetProperty("FilePath",BLLClassDirectory);
template.Render(Console.Out);
}
}
}
}
public void GenBLLSelf()
{
CodeTemplateCompiler compiler=new CodeTemplateCompiler(this.CodeTemplateInfo.DirectoryName+"GenBLLSelf.cst");
compiler.Compile();
CodeTemplate template;
if(compiler.Errors.Count==0)
{
for(int i=0;i<CurDB.Tables.Count;i++)
{
if(CurDB.Tables[i].Name.ToLower()!="dtproperties")
{
template=compiler.CreateInstance();
TableSchema table=CurDB.Tables[i];
template.SetProperty("SourceTable",table);
template.SetProperty("FilePath",BLLClassDirectorySelf);
template.Render(Console.Out);
}
}
}
}
</script>
2009年04月02日 08点04分 5
level 0
<%@ CodeTemplate Language="C#" TargetLanguage="XML" Description="Generate a xml file for the specified table" %>
<%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="A table"%>
<%@ Property Name="FilePath" Type="String" Category="Context" Description="The target path where file is saved" %>
<%@ Assembly Name="SchemaExplorer" %>
<%@ Assembly Name="System.Data" %>
<%@ Import Namespace="SchemaExplorer" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<?xml version="1.0" encoding="UTF-8" ?>
<sqlMap namespace="<%=SourceTable.Name%>" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<% int i=0;%>
<statements>
<select id="Get<%=SourceTable.Name%>AllByHashtable" parameterClass="hashtable" resultClass="<%=SourceTable.Name%>">
select
*
from
<%=SourceTable.Name%>
</select>
<% if(IsHaveFK()){ %>
<select id="Get<%=SourceTable.Name%>AllByHashtableFK" parameterClass="hashtable" resultMap="<%=SourceTable.Name%>Result">
select
<%for(i=0;i<SourceTable.Columns.Count;i++){%>
<%=ReturnSelectColumn(i)%>
<% } %>
from
<%=SourceTable.Name%>
<%for(i=0;i<SourceTable.Columns.Count;i++){%>
<% if(SourceTable.Columns[i].IsForeignKeyMember){ %>
left join <%=GetForeignInfoList2(SourceTable.Name,i+1)%> on <%=SourceTable.Name%>.<%=SourceTable.Columns[i].Name%>=<%=GetForeignInfoList2(SourceTable.Name,i+1)%>.ID
<% } %>
<% } %>
</select>
<% } %>
</statements>
</sqlMap>
<script runat="template">
public override void Render(TextWriter writer)
{
StreamWriter fileWriter1=new StreamWriter(FilePath+"/My"+SourceTable.Name+".xml",false);
this.Response.AddTextWriter(fileWriter1);
base.Render(writer);

2009年04月02日 08点04分 6
level 0
fileWriter1.Close();
}
public bool IsHaveFK()
{
for (int i=0;i<SourceTable.Columns.Count;i++)
{
if(SourceTable.Columns[i].IsForeignKeyMember)
return true;
}
return false;
}
public string GetName2(bool flag,int i)
{
if(flag)
{
return SourceTable.Columns[i].Name+GetForeignInfoList2(SourceTable.Name,i+1)+".ID";
}
else
{
return SourceTable.Columns[i].Name;
}
}
public string GetForeignInfoList2(string TableName,int CorderID)
{
string sql="select TableName=b.name from syscolumns a,sysobjects b,sysforeignkeys c where c.fkeyid= (SELECT top 1 id FROM sysobjects WHERE (name = '"+TableName+"')) and c.fkey="+CorderID
+" and c.rkeyid=b.id and c.rkeyid=a.id and c.rkey=a.colorder";
using(SqlDataAdapter MyDataAdapter = new SqlDataAdapter(sql,SourceTable.Database.ConnectionString))
{
DataSet MyDataSet=new DataSet();
MyDataAdapter.Fill(MyDataSet);
return MyDataSet.Tables[0].Rows[0][0].ToString();
}
}
public DataTable ReturnFKColumns(string TableName)
{
string sql="select Columnname=a.name from syscolumns a ,sysobjects b "
+"where a.id=b.id and b.name='"+TableName+"' order by a.colorder";
using(SqlDataAdapter MyDataAdapter = new SqlDataAdapter(sql,SourceTable.Database.ConnectionString))
{
DataSet MyDataSet=new DataSet();
MyDataAdapter.Fill(MyDataSet);
return MyDataSet.Tables[0];
}
}
public string ReturnSelectColumn(int i)
{
string temp="";
if(SourceTable.Columns[i].IsForeignKeyMember)
{
DataTable dt= ReturnFKColumns(GetForeignInfoList2(SourceTable.Name,i+1));
for(int j=0;j<dt.Rows.Count;j++)
{
temp+=GetForeignInfoList2(SourceTable.Name,i+1)+"_"+dt.Rows[j][0].ToString()+"="+GetForeignInfoList2(SourceTable.Name,i+1)+"."+dt.Rows[j][0].ToString()+",";
}
}
else
{
temp+=SourceTable.Name+"_"+SourceTable.Columns[i].Name+"="+SourceTable.Name+"."+SourceTable.Columns[i].Name+",";
}
if(i==SourceTable.Columns.Count-1)
return temp.Substring(0,temp.Length-1);
else
return temp;
}
public string ReturnSelectTables()
{
string temp=SourceTable.Name;
for(int i=0;i<SourceTable.Columns.Count;i++)
{
if(SourceTable.Columns[i].IsForeignKeyMember)
{
temp+=" left join "+GetForeignInfoList2(SourceTable.Name,i+1)+" on "+SourceTable.Name+"."+SourceTable.Columns[i].Name+"="+GetForeignInfoList2(SourceTable.Name,i+1)+".ID";
}
}
return temp;
}
</script>
2009年04月02日 08点04分 7
level 0
<?xml version="1.0" encoding="utf-8" ?>
<daoConfig xmlns="http://ibatis.apache.org/dataAccess
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
 <providers resource="providers.config"/>
 
 <context id="SqlMapDao" default="true">
 
 <properties resource="DataBase.config"/>
 <database>
 <provider name="sqlServer2.0"/>
 <!--数据库连接驱动字符串-->
 <dataSource name="ConnString" connectionString="data source=${datasource};database=${database};user id=${userid};password=${password};"/>
 </database>
 
 <!--添加一个属性对SqlMap进行引用。-->
 <daoSessionHandler id="SqlMap">
 <property name="resource" value="SqlMap.config"/>
 </daoSessionHandler>
 <!--接口和实现类。。和Castle里的IOC感觉很相似-->
 <daoFactory>
 <dao interface="DAL.Interfaces.ICommonDao,DAL" 
 implementation="DAL.MapperDao.CommonDao,DAL"/>
 <!--命名方式:命名空间.类名,项目名称-->
 </daoFactory>
 </context>
</daoConfig>
2009年04月03日 03点04分 9
level 0
你真的想学加 :452178395
2010年01月31日 15点01分 11
level 0
我教你。哥是高手。741651827
2010年06月19日 11点06分 12
level 1
2010年09月12日 05点09分 13
1