存储过程生成后的代码演示
对于存储过程的调用, 今日发布的版本中以及将接口放在了一个新的类中, 即SPHelper ,专门用来处理存储过程。
SPHelper 同样也是泛型类, 而且需要传递两个 类型,T为返回值类型, K为List时使用, 而当List时,T固定为int型。
生成后的代码如下:
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:2.0.50727.3053
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
// 生成日期:20090514015505
namespace DAL {
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using Keel.ORM;
public class SP {
public static int coop_tb_codfiles_GetAll(out List<Model.tb_codfiles> _ListOut_keel) {
Keel.SPHelper<int, Model.tb_codfiles> dbi = new Keel.SPHelper<int, Model.tb_codfiles>();
return dbi.ExcStoredProcedure("coop_tb_codfiles_GetAll", Keel.SPExcMethod.List, out _ListOut_keel);
}
public static System.Data.DataTable coop_tb_codsoftitem_GetAll() {
Keel.SPHelper<System.Data.DataTable, object> dbi = new Keel.SPHelper<System.Data.DataTable, object>();
return dbi.ExcStoredProcedure("coop_tb_codsoftitem_GetAll", Keel.SPExcMethod.Fill);
}
public static int coop_tb_user_GetAll(out List<Model.tb_user> _ListOut_keel) {
Keel.SPHelper<int, Model.tb_user> dbi = new Keel.SPHelper<int, Model.tb_user>();
return dbi.ExcStoredProcedure("coop_tb_user_GetAll", Keel.SPExcMethod.List, out _ListOut_keel);
}
public static int coop_tb_codfiles_Insert(string @filemd5, string @filepath) {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
string[] names = new string[] {
"@filemd5",
"@filepath"};
object[] values = new object[] {
@filemd5,
@filepath};
return dbi.ExcStoredProcedure("coop_tb_codfiles_Insert", Keel.SPExcMethod.ExecuteNonQuery, names, values);
}
public static Model.tb_codfiles coop_tb_codfiles_GetOne(string @filemd5) {
Keel.SPHelper<Model.tb_codfiles, object> dbi = new Keel.SPHelper<Model.tb_codfiles, object>();
string[] names = new string[] {
"@filemd5"};
object[] values = new object[] {
@filemd5};
return dbi.ExcStoredProcedure("coop_tb_codfiles_GetOne", Keel.SPExcMethod.Model, names, values);
}
public static int coop_tb_codfiles_Delete(string @filemd5) {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
string[] names = new string[] {
"@filemd5"};
object[] values = new object[] {
@filemd5};
return dbi.ExcStoredProcedure("coop_tb_codfiles_Delete", Keel.SPExcMethod.ExecuteNonQuery, names, values);
}
public static int coop_tb_codfiles_Update(string @filemd5, string @filepath, string @PK_filemd5) {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
string[] names = new string[] {
"@filemd5",
"@filepath",
"@PK_filemd5"};
object[] values = new object[] {
@filemd5,
@filepath,
@PK_filemd5};
return dbi.ExcStoredProcedure("coop_tb_codfiles_Update", Keel.SPExcMethod.ExecuteNonQuery, names, values);
}
public static int test1() {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
return dbi.ExcStoredProcedure("test1", Keel.SPExcMethod.ExecuteNonQuery);
}
}
}
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:2.0.50727.3053
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
// 生成日期:20090514015505
namespace DAL {
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Text;
using Keel.ORM;
public class SP {
public static int coop_tb_codfiles_GetAll(out List<Model.tb_codfiles> _ListOut_keel) {
Keel.SPHelper<int, Model.tb_codfiles> dbi = new Keel.SPHelper<int, Model.tb_codfiles>();
return dbi.ExcStoredProcedure("coop_tb_codfiles_GetAll", Keel.SPExcMethod.List, out _ListOut_keel);
}
public static System.Data.DataTable coop_tb_codsoftitem_GetAll() {
Keel.SPHelper<System.Data.DataTable, object> dbi = new Keel.SPHelper<System.Data.DataTable, object>();
return dbi.ExcStoredProcedure("coop_tb_codsoftitem_GetAll", Keel.SPExcMethod.Fill);
}
public static int coop_tb_user_GetAll(out List<Model.tb_user> _ListOut_keel) {
Keel.SPHelper<int, Model.tb_user> dbi = new Keel.SPHelper<int, Model.tb_user>();
return dbi.ExcStoredProcedure("coop_tb_user_GetAll", Keel.SPExcMethod.List, out _ListOut_keel);
}
public static int coop_tb_codfiles_Insert(string @filemd5, string @filepath) {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
string[] names = new string[] {
"@filemd5",
"@filepath"};
object[] values = new object[] {
@filemd5,
@filepath};
return dbi.ExcStoredProcedure("coop_tb_codfiles_Insert", Keel.SPExcMethod.ExecuteNonQuery, names, values);
}
public static Model.tb_codfiles coop_tb_codfiles_GetOne(string @filemd5) {
Keel.SPHelper<Model.tb_codfiles, object> dbi = new Keel.SPHelper<Model.tb_codfiles, object>();
string[] names = new string[] {
"@filemd5"};
object[] values = new object[] {
@filemd5};
return dbi.ExcStoredProcedure("coop_tb_codfiles_GetOne", Keel.SPExcMethod.Model, names, values);
}
public static int coop_tb_codfiles_Delete(string @filemd5) {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
string[] names = new string[] {
"@filemd5"};
object[] values = new object[] {
@filemd5};
return dbi.ExcStoredProcedure("coop_tb_codfiles_Delete", Keel.SPExcMethod.ExecuteNonQuery, names, values);
}
public static int coop_tb_codfiles_Update(string @filemd5, string @filepath, string @PK_filemd5) {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
string[] names = new string[] {
"@filemd5",
"@filepath",
"@PK_filemd5"};
object[] values = new object[] {
@filemd5,
@filepath,
@PK_filemd5};
return dbi.ExcStoredProcedure("coop_tb_codfiles_Update", Keel.SPExcMethod.ExecuteNonQuery, names, values);
}
public static int test1() {
Keel.SPHelper<int, object> dbi = new Keel.SPHelper<int, object>();
return dbi.ExcStoredProcedure("test1", Keel.SPExcMethod.ExecuteNonQuery);
}
}
}
生成后的代码调用方式
private void button6_Click(object sender, EventArgs e)
{
this.dataGridView1.DataSource = DAL.SP.coop_tb_codsoftitem_GetAll();
}
private void button7_Click(object sender, EventArgs e)
{
Keel.DBHelper<Model.fadsdsfas> fsd = new Keel.DBHelper<Model.fadsdsfas>();
this.dataGridView1.DataSource = fsd.GetDataViewForObjectList();
}
{
this.dataGridView1.DataSource = DAL.SP.coop_tb_codsoftitem_GetAll();
}
private void button7_Click(object sender, EventArgs e)
{
Keel.DBHelper<Model.fadsdsfas> fsd = new Keel.DBHelper<Model.fadsdsfas>();
this.dataGridView1.DataSource = fsd.GetDataViewForObjectList();
}
KeelKit 一款国产ORM工具,自动生成Model、自动生成表单、自动生成单元测试框架、自动生成存储过程访问接口、自动配置连接字符串,代码行数统计、程序集版本号码控制、源码HTML生成、自动生成表结构Word文档、自动支持各种.Net项目,如F# 和IronPython ,自动生成与其它语言交换的Model、使用了泛型的DBHelper、查询语句强类型化、支持事务、无语言界限、无数据库界限!