NBearLite 更新至v1.0.0.6 beta
全面支持SqlServer,Oracle,MySql,PostgreSql數據庫存儲過程調用代碼生成(C#/VB.NET),支持輸入、輸出、返回等各種參數類型。
支持Sub Query。
支持Save DataTable/DataRow。
詳見:http://www.cnblogs.com/teddyma/archive/2007/07/20/825384.html
使用簡介
使用NBearLite.QueryColumnsGenerator.exe工具並指定目標數據庫類型和連接字符串,生成的存儲過程調用代碼類似下面這樣:
2 if ((db == null)) {
3 throw new System.ArgumentNullException("db", "Parameter: db could not be null!");
4 }
5 NBearLite.StoredProcedureSection spSection = db.StoredProcedure("SalesByCategoryTest");
6 System.Collections.Generic.Dictionary<string, object> outValues;
7 spSection.SetReturnParameter("RETURN_VALUE", System.Data.DbType.Int32, 0);
8 spSection.AddInputParameter("CategoryName", System.Data.DbType.String, CategoryName);
9 spSection.AddInputParameter("OrdYear", System.Data.DbType.String, OrdYear);
10 spSection.AddInputOutputParameter("OutP", System.Data.DbType.String, 5, OutP);
11 System.Data.DataSet ds = spSection.ToDataSet(out outValues);
12 RETURN_VALUE = ((int)(outValues["RETURN_VALUE"]));
13 OutP = ((string)(outValues["OutP"]));
14 return ds;
15 }
調用該代碼的示例:
string outStr = "";
DataSet ds = Northwind.SalesByCategoryTest(db, out ret, "test1", "1997", ref outStr);
存儲過程SalesByCategoryTest包含四個參數,分別是兩個輸入,一個輸出(對應out參數),一個輸入輸出參數(對應ref參數),同時還返回一個DataSet。
更多關於NBearLite的介紹可以訪問:http://www.cnblogs.com/teddyma/archive/2007/07/20/825384.html和http://nbear.org
附錄:NBearV4預告及開發團隊成員徵集