![]() |
Sergey Kornilov admin 5/27/2009 |
The easiest way is to extend controller class. Suppose you have a |
A
|
adamherman@hotmail.com author 5/28/2009 |
Thanks, I appreciate the example. My project is a VB project and I am a VB guy. Do you have any examples in VB so I can test it in my project? The easiest way is to extend controller class. Suppose you have a table "Customers" then there is a matching controller class CustomersController in the project. This class is partial so you can add your own methods to it in a separate file or use existing CustomersController.cs. Below is a sample method that does exactly that - gets a collection of customer objects by SQL query. [System.ComponentModel.DataObject] public partial class CustomersController { [DataObjectMethod(DataObjectMethodType.Select, false)] public CustomersCollection FetchBySQL(string sql) { QueryCommand cmd = new QueryCommand(sql); CustomersCollection coll = new CustomersCollection(); coll.LoadAndCloseReader(DataService.GetReader(cmd)); return coll; } } Then replace FetchAllPaged call with this method call. Don't forget that FetchAllPaged has more parameters than FetchBySQL. ASPRunner.NET uses SubSonic open source data access library to generate data access layer and you can find more info how to use it on http://subsonicproject.com/ |
![]() |
Sergey Kornilov admin 5/29/2009 |
Try this: Public Partial Class CustomersController |