利用Grove Tool Kit 连接NorthWind 并生成Customers、Orders、Employees实体类
1、ObjectOperator
//实例化ObjectOperator类
string conn=System.Configuration.ConfigurationSettings.AppSettings["strconnection"];
Grove.ORM.ObjectOperator obj=new ObjectOperator(conn);
| Method | Description |
| Insert | Insert an object into the data source |
| Update | Update an object |
| Remove | Delete an object from the data source |
| RemoveChilds | Delete child objects |
| Retrieve | Returns an object from the data source |
| RetrieveChilds | Returns child objects from the data source |
| GetDataReader | Returns an IDataReader from the data source |
| GetObjectSet | Returns a collection of object values |
| GetObjectSource | Returns a DataSet which contain the data source of the object |
| GetCount | Returns a records count of the data source |
| BeginTranscation | Begins a transaction at the data source, if transactions are supported by the data source. |
| Commit | Commits the current transaction. |
| Rollback | Rolls back the current transaction. |
2、ObjectQuery 类
//实例化ObjectQuery ,返回对象的所有记录集
ObjectQuery query = new ObjectQuery (typeof(Customer),"");
3、返回DataSet 数据集
Grove.ORM.ObjectOperator obj=new ObjectOperator(conn);
Grove.ORM.ObjectQuery query = new ObjectQuery (typeof(Customers),"");
DataSet ds = obj.GetObjectSource(query);
4、返回ArrayList集合
Grove.ORM.ObjectOperator obj=new ObjectOperator(conn);
Grove.ORM.ObjectQuery query = new ObjectQuery (typeof(Customers),"");
ArrayList al = obj.GetObjectSet(query);
5、返回IDataReader
Grove.ORM.ObjectOperator obj=new ObjectOperator(conn);
Grove.ORM.ObjectQuery query = new ObjectQuery (typeof(Customers),"");
IDataReader dr = obj.GetDataReader(query);
浙公网安备 33010602011771号