.net项目开发工具接口说明

 

    .net项目开发工具的主体功能由三个基本的接口构成:数据访问接口、生成SQL的接口和生成主程序代码的接口。
   
    一。数据访问接口。
        提供数据库访问的一系列功能接口(位于项目IDAL中),具体如下: 

ContractedBlock.gif ExpandedBlockStart.gif 数据访问接口
None.gifusing System;
None.gif
using System.Collections.Generic;
None.gif
using System.Text;
None.gif
using System.Data;
None.gif
using System.Data.SqlClient;
None.gif
using System.Windows.Forms;
None.gif
None.gif
using Hxw.DE.Model;
None.gif
None.gif
namespace Hxw.DE.IDAL
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 数据访问接口。
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public interface IDataaccess
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取当前连接的数据库名称。
ExpandedSubBlockEnd.gif        
/// </summary>

ExpandedSubBlockStart.gifContractedSubBlock.gif        string CurrentDatabase dot.gifget;}
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取当前数据库访问角色。
ExpandedSubBlockEnd.gif        
/// </summary>

ExpandedSubBlockStart.gifContractedSubBlock.gif        string DatabaseOwner dot.gifget;}
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 数据库连接测试。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="connString">数据库连接字符串</param>
ExpandedSubBlockEnd.gif        
/// <returns>返回连接成功与否(true为成功;false为不成功)</returns>

InBlock.gif        bool DBConnect(string connString);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 判断数据库中某个对象是否存在。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="_object">对象名称</param>
ExpandedSubBlockEnd.gif        
/// <returns>返回对象是否存在(true为存在;false为不存在)</returns>

InBlock.gif        bool OjbectIsExists(string _object);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取当前数据库中的所有数据表。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     DataSet中DataTable需要获取的列:name(数据表名称),id(数据表ID)
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <example>
InBlock.gif        
/// select name,id from dot.gif
InBlock.gif        
/// </example>
ExpandedSubBlockEnd.gif        
/// <returns>TablesBUSEntity实体对象</returns>

InBlock.gif        DataSet GetTables();
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取数据表说明。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="table">指定的数据表</param>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     1.如果table为空,则获取当前数据库中所有数据表的说明。
InBlock.gif        
/// </remarks>
ExpandedSubBlockEnd.gif        
/// <returns>数据表说明泛型集合</returns>

InBlock.gif        List<string> GetTableDescription(string table);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取与指定的数据表相关的存储过程或根据关键字搜索存储过程。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="table">数据表</param>
InBlock.gif        
/// <param name="keywords">搜索关键字</param>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     1.如果table参数不为空,则获取与当前数据表相关的存储过程(即当前存储过程名称包括表名称,如:%表名%)。
InBlock.gif        
///     2.如果table参数为空,则获取当前数据库中的所有存储过程;
InBlock.gif        
///     3.如果keywords参数不为空,则从获取的存储过程的名称或存储过程内容中匹配关键字。
InBlock.gif        
///     DataSet中DataTable需要获取的列:name(存储过程名称),id(存储过程ID)
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <example>
InBlock.gif        
///     select name,id from dot.gif
InBlock.gif        
/// </example>
ExpandedSubBlockEnd.gif        
/// <returns>DataSet对象</returns>

InBlock.gif        DataSet GetProcedures(string table, string keywords);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取指定的数据表的所有相关信息。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="table">数据表</param>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     此DataSet由三个数据表构成:
InBlock.gif        
///     1.数据列相关信息表,需要获取的列:name(列名称),colid(列ID),columnid(列在表中的编号),isnullable(列是否允许为空),types(列数据类型),length(列数据长度),defaultValue(列默认值),columnRemark(列说明),Precisionvalue(列精度值),Decimaldigitvalue(列小数位数)
InBlock.gif        
///     2.当前数据表的所有主外键表,需要获取的列: index_name(主外键名称),index_description(说明),index_keys(主外键列名称)
InBlock.gif        
///     3.自动递增表,需要获取的列: Identity(自动递增列名称),Seed(标识种子),increment(标识递增量)
InBlock.gif        
///     详情请参见DatacolumnsBUSEntity模型
InBlock.gif        
/// </remarks>
ExpandedSubBlockEnd.gif        
/// <returns>DatacolumnsBUSEntity对象</returns>

InBlock.gif        DatacolumnsBUSEntity GetColumns(string table);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取某一对象的所有成员。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="_obj">对象名称或对象编号</param>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     DataSet中DataTable需要获取的列:name(成员名称),id(成员ID),types(成员数据类型),length(成员数据长度),isoutparam(存成员类型[是否为输出参数])。
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <example>
InBlock.gif        
///     select name,id,types,length,isoutparam from dot.gif
InBlock.gif        
/// </example>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        DataSet GetObjectMembers(string _obj);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取某个对象的详细内容(如存储过程内容等)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="_object">对象名称或ID</param>
ExpandedSubBlockEnd.gif        
/// <returns>该对象的详细内容</returns>

InBlock.gif        string GetComments(string _object);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 删除数据表。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="tableList">数据表名称泛型(即一次可删除多个数据表,需启用事务控制)</param>

InBlock.gif        void DropTable(List<string> tableList);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 清空数据库日志。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        void ClearDBLog();
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 收缩数据库。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        void ShrinkDB();
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 移除存储过程。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="procedureList">存储过程名称泛型(即一次可删除多个存储过程,需启用事务控制)</param>

InBlock.gif        void DropProcedures(List<string> procedureList);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行某段SQL脚本。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     rollback参数为ture时,是为了分析SQL代码,而不是真正执行SQL代码。
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <param name="sqlText">sql脚本</param>
ExpandedSubBlockEnd.gif        
/// <param name="rollback">是否回滚操作</param>

InBlock.gif        bool ExecuteNonQuery(string sqlText, bool rollback);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行某段SQL脚本,如果对象存在,则询问是否覆盖。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sqlText">SQL脚本</param>
InBlock.gif        
/// <param name="message">输出消息</param>
InBlock.gif        
/// <param name="objectName">对象名称</param>
ExpandedSubBlockEnd.gif        
/// <returns>对象类型(ObjectXTypes枚举值之一)</returns>

InBlock.gif        ObjectXTypes ExecuteNonQueryConfirm(string sqlText, ref string message, ref string objectName);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 执行某段SQL脚本并返回一个DataSet对象。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sqlText">sql脚本</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        DataSet ExecuteDataset(string sqlText);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif         
/**//// <summary>
InBlock.gif        
/// 执行某段SQL脚本,如果对象存在,则询问是否覆盖。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sqlText">SQL脚本</param>
InBlock.gif        
/// <param name="message">输出消息</param>
InBlock.gif        
/// <param name="objectName">对象名称</param>
ExpandedSubBlockEnd.gif        
/// <returns>DataSet</returns>

InBlock.gif        DataSet ExecuteDatasetConfirm(string sqlText, ref string message, ref string objectName);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 调试执行存储过程。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="procedure">存储过程名称</param>
InBlock.gif        
/// <param name="list">当前存储过程参数泛型对象</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        DataSet ExecuteProcedure(string procedure, List<ParmParameter> list);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif         
/**//// <summary>
InBlock.gif        
/// 执行某段SQL脚本(ExecuteScalar)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="sqlText">sql脚本</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        object ExecuteScalar(string sqlText);
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取当前数据库中所有自定义函数。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     DataSet中DataTable需要获取的列:name(自定义函数名称),id(自定义函数ID)
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <example>
InBlock.gif        
///     select name,id from dot.gif
InBlock.gif        
/// </example>
ExpandedSubBlockEnd.gif        
/// <returns>DataSet对象</returns>

InBlock.gif        DataSet GetFunctions();
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取当前数据库中所有视图。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     DataSet中DataTable需要获取的列:name(视图名称),id(视图ID)
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <example>
InBlock.gif        
///     select name,id from dot.gif
InBlock.gif        
/// </example>
ExpandedSubBlockEnd.gif        
/// <returns>DataSet对象</returns>

InBlock.gif        DataSet GetViews();
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 移除视图。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="view">将要删除的视图名称泛型</param>

InBlock.gif        void DropView(List<string> viewList);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 移除自定义函数。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="view">将要删除的自定义函数名称泛型</param>

InBlock.gif        void DropFunction(List<string> functionList);  
InBlock.gif      
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 根据对象名称获取该对象的类型。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     比如:判断是数据表、视图、存储过程或自定义数据类型等。
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <param name="objectName">对象名称</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        ObjectXTypes GetObjectXType(string objectName);   
InBlock.gif     
ExpandedSubBlockStart.gifContractedSubBlock.gif         
/**//// <summary>
InBlock.gif        
/// 获取当前数据库类型的所有数据类型。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns>数据类型泛型</returns>

InBlock.gif        DataTypeCollection GetDataTypes();
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif         
/**//// <summary>
InBlock.gif        
/// 获取当前数据表的所有主、外键约束(关系)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="table">数据表</param>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     DataSet中DataTable需要获取的列:name(关系名称),fkeyTableName(外键表名称),rkeyTableName(主键表名称),fkeyColumnName(外键表列名称),rkeyColumnName(主键表列名称)
InBlock.gif        
/// </remarks>
InBlock.gif        
/// <example>
InBlock.gif        
///     select name,fkeyTableName,rkeyTableName,fkeyColumnName,rkeyColumnName from dot.gif
InBlock.gif        
/// </example>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        DataSet GetPrimaryConstraint(string table);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 保存数据表。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="data">要保存的数据</param>
ExpandedSubBlockEnd.gif        
/// <param name="tableFrame">要保存的数据表的数据结构</param>

InBlock.gif        void SaveData(DataSet data, DataTable tableFrame);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 载入指定数据表的所有数据。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="table">数据表</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        DataSet LoadData(string table);
InBlock.gif
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif


  二。生成SQL代码接口。
        提供生成本数据库类型的相关SQL脚本的一系列功能接口(位于项目ICode中),如创建存储过程、视图的代码,的功能具体如下: 

ContractedBlock.gif ExpandedBlockStart.gif 生成SQL脚本的接口
ExpandedBlockStart.gifContractedBlock.gif /**//// <summary>
InBlock.gif    
/// 生成SQL脚本的接口类。
ExpandedBlockEnd.gif    
/// </summary>

None.gif    public interface ICodeSqlscript
ExpandedBlockStart.gifContractedBlock.gif    
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 创建存储过程(插入)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">数据结构</param>
InBlock.gif        
/// <param name="name">存储过程名称</param>
InBlock.gif        
/// <param name="table">要创建存储过程的数据表名</param>
InBlock.gif        
/// <param name="execMode">数据库命令执行方式(ExecuteReader、DataSet、ExecuteNonQuery or ExecuteScalar)</param>
InBlock.gif        
/// <param name="comment">备注</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string Create_Procedure_Insert(DataSet dataColumns, string name, string table,string execMode,string comment);
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 创建存储过程(更新)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">数据结构</param>
InBlock.gif        
/// <param name="name">存储过程名称</param>
InBlock.gif        
/// <param name="table">要创建存储过程的数据表名</param>
InBlock.gif        
/// <param name="execMode">数据库命令执行方式(ExecuteReader、DataSet、ExecuteNonQuery or ExecuteScalar)</param>
InBlock.gif        
/// <param name="comment">备注</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string Create_Procedure_Update(DataSet dataColumns, string name, string table, string execMode, string comment);
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 创建存储过程(删除)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">数据结构</param>
InBlock.gif        
/// <param name="name">存储过程名称</param>
InBlock.gif        
/// <param name="table">要创建存储过程的数据表名</param>
InBlock.gif        
/// <param name="execMode">数据库命令执行方式(ExecuteReader、DataSet、ExecuteNonQuery or ExecuteScalar)</param>
InBlock.gif        
/// <param name="comment">备注</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string Create_Procedure_Delete(DataSet dataColumns, string name, string table, string execMode, string comment);
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 创建存储过程(选择)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">数据结构</param>
InBlock.gif        
/// <param name="name">存储过程名称</param>
InBlock.gif        
/// <param name="table">要创建存储过程的数据表名</param>
InBlock.gif        
/// <param name="execMode">数据库命令执行方式(ExecuteReader、DataSet、ExecuteNonQuery or ExecuteScalar)</param>
InBlock.gif        
/// <param name="comment">备注</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string Create_Procedure_Select(DataSet dataColumns, string name, string table, string execMode, string comment);
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 创建存储过程(选择并且分页)。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">数据结构</param>
InBlock.gif        
/// <param name="name">存储过程名称</param>
InBlock.gif        
/// <param name="table">要创建存储过程的数据表名</param>
InBlock.gif        
/// <param name="execMode">数据库命令执行方式(ExecuteReader、DataSet、ExecuteNonQuery or ExecuteScalar)</param>
InBlock.gif        
/// <param name="comment">备注</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string Create_Procedure_Select_Paging(DataSet dataColumns, string name, string table, string execMode, string comment);
ExpandedSubBlockStart.gifContractedSubBlock.gif         
/**//// <summary>
InBlock.gif        
/// 创建自定义函数代码。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string Create_Function();
ExpandedSubBlockStart.gifContractedSubBlock.gif         
/**//// <summary>
InBlock.gif        
/// 创建视图代码。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string Create_View();       
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 从数据结构生成创建数据表的SQL。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">数据结构</param>
InBlock.gif        
/// <param name="table">数据表</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string GetCreateTableSQL(DataSet dataColumns, string table);
ExpandedSubBlockStart.gifContractedSubBlock.gif         
/**//// <summary>
InBlock.gif        
/// 从数据表结构生成Html代码。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">数据结构</param>
InBlock.gif        
/// <param name="table">数据表</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        string GetHtml(DataSet dataColumns, string table);        
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取数据表设计器对象。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="table">数据表</param>
InBlock.gif        
/// <param name="created">是否创建数据表</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        AbstractTableDesign TableDesignInstance(string table,bool created);
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取数据表设计器对象。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="table">数据表</param>
InBlock.gif        
/// <param name="created">是否创建数据表</param>
ExpandedSubBlockEnd.gif        
/// <returns></returns>

InBlock.gif        AbstractDataViewer TableViewInstance(string table);
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取 是否允许创建或修改数据表。
ExpandedSubBlockEnd.gif        
/// </summary>

ExpandedSubBlockStart.gifContractedSubBlock.gif        bool EditorTableabledot.gif{get;}
ExpandedBlockEnd.gif    }


三。生成主程序代码接口。
        提供生成主程序代码的一系列功能接口(位于项目ICode中),的功能具体如下: 

ContractedBlock.gif ExpandedBlockStart.gif ICodeProgramme
None.gifusing System;
None.gif
using System.Collections.Generic;
None.gif
using System.Text;
None.gif
using System.Data;
None.gif
None.gif
using Hxw.DE.IBase;
None.gif
using Hxw.DE.IDAL;
None.gif
None.gif
namespace Hxw.DE.ICode
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 生成主程序代码的接口。
InBlock.gif    
/// </summary>
InBlock.gif    
/// <remarks>
InBlock.gif    
///     根据业务层的需要,生成N层代码。
ExpandedSubBlockEnd.gif    
/// </remarks>

InBlock.gif    public interface ICodeProgramme:IDisposable
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{      
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取 生成代码的参数类的泛型集合。
ExpandedSubBlockEnd.gif        
/// </summary>

ExpandedSubBlockStart.gifContractedSubBlock.gif        List<ParmGenerateCode> GenerateCodeList dot.gifget;}      
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取 当前生成的代码类型(编辑器高度显示)。
ExpandedSubBlockEnd.gif        
/// </summary>

ExpandedSubBlockStart.gifContractedSubBlock.gif        CodeTypes Codetype dot.gifget;}
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取 当前生成的代码要保存为文件时的文件扩展名。
ExpandedSubBlockEnd.gif        
/// </summary>

ExpandedSubBlockStart.gifContractedSubBlock.gif        string FileExtension dot.gifget;}    
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当配置选项发生改变时。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="bllAbstract">是否抽象业务逻辑</param>
InBlock.gif        
/// <param name="enableCaching">当允许或禁用缓存</param>
InBlock.gif        
/// <remarks>   
InBlock.gif        
///     当配置参数发生改变时,生成的代码将会发生变化。
ExpandedSubBlockEnd.gif        
/// </remarks>

InBlock.gif        void OnOptionsChanged(bool bllAbstract, bool enableCaching);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif           
/**//// <summary>
InBlock.gif        
/// 当配置选项发生改变时。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="bllAbstract">是否抽象业务逻辑</param>
InBlock.gif        
/// <param name="enableCaching">当允许或禁用缓存</param>
InBlock.gif        
/// <param name="namingRulesList">类命名规则集合</param>
InBlock.gif        
/// <param name="table">当前操作的数据表</param>
ExpandedSubBlockEnd.gif        
/// <param name="tableTagPrefix">要剔除的数据表前缀(空表示不剔除前缀)</param>

InBlock.gif        void OnOptionsChanged(bool bllAbstract, bool enableCaching, SortedList<stringstring> namingRulesList, string table,string tableTagPrefix);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 开始生成代码。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <param name="dataColumns">当前数据表的数据结构模型</param>
InBlock.gif        
/// <param name="table">当前需要生成代码的数据有名称</param>
InBlock.gif        
/// <param name="spList">指定为某指定的存储过程创建代码的存储过程泛型(如果不为空)</param>
InBlock.gif        
/// <param name="namespaceList">代码命名空间键值集合对象</param>
InBlock.gif        
/// <param name="namingRulesList">类命名规则键值泛型对象</param>
InBlock.gif        
/// <param name="plugin_Dataaccess">数据访问插件</param>
InBlock.gif        
/// <param name="bllAbstract">是否抽象业务逻辑</param>
InBlock.gif        
/// <param name="enableCaching">生成启用缓存功能的主程序代码或禁用缓存的主程序代码</param>
InBlock.gif        
/// <param name="cachingFullClass">公共代码层命名空间</param>
ExpandedSubBlockEnd.gif        
/// <param name="tableTagPrefix">要剔除的数据表前缀(空表示不剔除前缀)</param>

InBlock.gif        void Generate(DataSet dataColumns, string table, List<string> spList, SortedList<stringstring> namespaceList, SortedList<stringstring> namingRulesList, IDataaccess plugin_Dataaccess, bool bllAbstract, bool enableCaching, string commonNamespace, string tableTagPrefix);       
ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

以下生成主程序代码的接口中一个重要的参数类:
ContractedBlock.gif ExpandedBlockStart.gif ParmGenerateCode
None.gifusing System;
None.gif
None.gif
namespace Hxw.DE.IBase
ExpandedBlockStart.gifContractedBlock.gif
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif    
/**//// <summary>
InBlock.gif    
/// 生成代码的 参数类。
ExpandedSubBlockEnd.gif    
/// </summary>

InBlock.gif    public class ParmGenerateCode
ExpandedSubBlockStart.gifContractedSubBlock.gif    
dot.gif{
ContractedSubBlock.gifExpandedSubBlockStart.gif        
构造器#region 构造器
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 构造器。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <param name="caption">当前代码层的标题</param>

InBlock.gif        public ParmGenerateCode(string caption)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
this.caption = caption;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
变量#region 变量
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前代码层的标题。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string caption = string.Empty;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前代码层的类名称。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string className = string.Empty;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前代码层的代码。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string code = string.Empty;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前代码是否单独保存。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private bool saveBySelf = true;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前代码层的片断代码(只有当saveBySelt为否时)。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string bittyCode = string.Empty;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 代码片断替换标签。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string bittyCodeReplacemen = string.Empty;
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 当前代码层的命名空间。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        private string namdspace = string.Empty;
InBlock.gif       
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
属性#region 属性
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取 当前代码层的标题。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string Caption
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this.caption; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取或设置 当前代码层的类名称。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string ClassName
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this.className; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gifthis.className = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取或设置 当前代码层的命名空间。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string Namdspace
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this.namdspace; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gifthis.namdspace = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取或设置 当前代码层的完整代码。
ExpandedSubBlockEnd.gif        
/// </summary>

InBlock.gif        public string Code
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this.code; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gifthis.code = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取或设置 当前代码是否单独保存。
InBlock.gif        
/// </summary>
InBlock.gif        
/// <remarks>
InBlock.gif        
///     主要是区分单独保存为一个文件和非单独保存的文件文件。
InBlock.gif        
///     以Petshop的架构为例:
InBlock.gif        
///         Model、IDAL、DAL和BLL层为单独保存的类型;
InBlock.gif        
///         DALFactory为非单独保存的类型,是将当前项目中所有需要创建DAL对象的过程放在一个文件中。
InBlock.gif        
///     设置此属性为false表示为非单独保存,同时将代码分为Code和BittyCode两部分代码。在批量生成代码时,累加BittyCode代码,
InBlock.gif        
///     到最后时,再将Code替换标签(BittyCodeReplacemen值设定)替换为累加的BittyCode代码,如此组成一个完整的代码。
ExpandedSubBlockEnd.gif        
/// </remarks>

InBlock.gif        public bool SaveBySelf
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this.saveBySelf; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gifthis.saveBySelf = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取或设置 当前代码层的片断代码。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <remarks>当SaveBySelf设置为false为有效</remarks>

InBlock.gif        public string BittyCode
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this.bittyCode; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gifthis.bittyCode = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif        
ExpandedSubBlockStart.gifContractedSubBlock.gif        
/**//// <summary>
InBlock.gif        
/// 获取或设置 代码片断替换标签。
InBlock.gif        
/// </summary>
ExpandedSubBlockEnd.gif        
/// <remarks>当SaveBySelf设置为false为有效</remarks>

InBlock.gif        public string BittyCodeReplacemen
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            
get dot.gifreturn this.bittyCodeReplacemen; }
ExpandedSubBlockStart.gifContractedSubBlock.gif            
set dot.gifthis.bittyCodeReplacemen = value; }
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

InBlock.gif
ContractedSubBlock.gifExpandedSubBlockStart.gif        
重载方法#region 重载方法
InBlock.gif
InBlock.gif        
public override string ToString()
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif            
return this.caption;
ExpandedSubBlockEnd.gif        }

InBlock.gif
ExpandedSubBlockEnd.gif        
#endregion

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif


   用户只需分别实现其中某个接口,即可在本系统中应用。注意,接口实现类同时必须实现PluginInfoAttribute属性,才能作为本系统中的合法插件,PluginInfoAttribute位于IBase项目中,须添加IBase的引用。PluginInfoAttribute的使用如下:

None.gif
None.gif[PluginInfo(
" MSSQLServer 2000数据访问类 " " 1.0.0.0 " " 版权所有(2005-2007) mrhgw " " mrhgw " "" " 提供数据访问的操作。适用数据库:MSSQLServer 2000 " )]
None.gif    
public   class  DALSqlserver2000 : AbstractDAL,IDataaccess
None.gif

   有兴趣的朋友可以试一下,如有疑问请留言或QQ:157561711(本人),41195215(.net项目开发讨论群)。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值