PDA

Click to See Complete Forum and Search --> : [RESOLVED] [.NET/Mono]LINQ: Intervention and custom filtering for optimization


eSPiYa
Apr 16th, 2010, 12:02 AM
I'm currently on the planning stage for my next project; Activerecord with LINQ support. Similar to "LINQ to SQL" and DBLinq but with a different approach.

What I need is several optimization with LINQ.

Fore example, I have a class/table 'Person'/'Persons':

[Table(Name="Persons")]
public class Person
{[Field(DataType=VarChar, Size=50)]
public string Name;
[Field]
public int Age;}


and execute this LINQ statement(assuming that 'Persons' a collection records from the table 'Persons' in the database):

var recPersons = from tPersons in Persons
where tPersons.Age == 18
select tPersons;

Its natural behavior would be, it will fetch all the records from the database then filter it on the application side.

What I want is the filter set on the LINQ statement will be pass immediately as filter with the internal SQL statement.

Is there a way to intervene with the process and fetch the filters?

Thanks for any help.

eSPiYa
Apr 21st, 2010, 09:50 PM
I think I found what I need. It is the LINQ Provider.