how to get filter records ?

Oct 19, 2007 at 6:15 AM
hi,
NuSoft Framework is quite looking good, but one thing i cant getting , how to get Filter records uging Nu Framework?
because its gives us the Insert , update, Delete, GetOne , GetAll records, but i didnt find any way to get only Filter records.

anyone pls reply with solution?

Thanks in Advanced...

Regards,
Coordinator
Oct 19, 2007 at 12:44 PM
The framework generates code for any relationships you have in your database. So if you set up Customers and Orders, with Orders referencing Customers by CustomerID, you will get a property in Customers called Orders, and a static method in the Order class called GetOrdersByCustomer().

You can also create your own custom methods in the one-time generated code files.
Oct 21, 2007 at 2:24 PM
yes , that is fine, but how to get filter records with one or more Filteres
ex: i want records of All Active Cutomer whose name start from 'S' ,
so how can we get those records?
any faciilty for Like operator or Where Paramters ? or how to get sort records by any table columns ?

i am getting only this problem to use this framework...
so reply with any solution and Code.

Thanks,
Jatin
Coordinator
Oct 22, 2007 at 3:07 PM
Edited Oct 22, 2007 at 3:08 PM


jatinsprajapati wrote:
yes , that is fine, but how to get filter records with one or more Filteres
ex: i want records of All Active Cutomer whose name start from 'S' ,
so how can we get those records?
any faciilty for Like operator or Where Paramters ? or how to get sort records by any table columns ?

i am getting only this problem to use this framework...
so reply with any solution and Code.

Thanks,
Jatin


Here is some sample code to do what you are asking.

public partial class Contact : EntityBase
{
public static EntityList<Contact> GetActiveContactByLastName(string likeClause)
{
SqlParameter p = new SqlParameter("@Like", likeClause);

return GetContacts("where lastname like @Like and Active = 1", p, "order by LastName ASC");
}
}

Just add a method to the partial class of your generated entitiy. Then define all the paramaters you want to filter by. Then use the protected overloads on the Get* method.

If you want to do a join then you will have to copy the code from the generated Get* method, create a new method in the partial class, edit the query and return the results. I hope that helps.
Oct 22, 2007 at 3:54 PM
Hi,
Thanks a lot for your kindly reply !

let me check those things in more details...