Use lambda with Ado.Net

1

Using sqldatareader and ado.net, can you use lambda with linq or just lambda or just linq? This is not a multiple question, but linq and lambda are always together, so the various "?", Ok?

    
asked by anonymous 05.06.2014 / 20:36

2 answers

1

I have very little experience with sqldatareader but contextualizing ...

ADO.NET is a set of classes that expose data access services for .NET Framework developers. The results of the data manipulation are processed, placed in a DataSet object of ADO.NET to be exposed to the user.

LINQ (Language-Integrated Query) allows developers to form set-based queries in their application code without having to use a separate query language, such as using SQL in C # . But LINQ works with data sources of type IEnumerable .

You can use all of these options, both linq and lambda with ado.net:

One option, which I believe to be interesting for you, would be to implement an extension method that would return an IEnumerable to iterate over the rows of your reader. In this post you have an example: link

Another option is to use LINQ to DataSet, which converts the data of your object collections into collections based on IEnumerable.

On using lambda I found this example too but I do not know if it's exactly what you want: link

    
05.06.2014 / 21:58
1

Using sqldatareader and ado.net, can you use lambda with linq or just lambda or just linq?

Yes

What you call "lambda" is actually a parameter of type Func<TSource, T> , which is a predicate . It does not coexist with the , as you can see from this link :

  

link

Like the do not necessarily need to use predicates to work, as examples of the link below:

  

link

    
05.06.2014 / 21:20