Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Convert this to non SQL like LINQ
Message
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01609048
Message ID:
01609363
Vues:
37
The beauty of Linq is that you can use either syntax without any downside and you can even mix and match the two together - just use ( ) to delimit your expressive LINQ SQL code and go on with the fluent syntax.

Personally I find the fluent syntax more natural to work with in code. For some things like JOINS though the expressive syntax is cleaner and easier to remember.

The important thing to remember - as John said - is that they produce the same thing, so use what is easier to you. One nice thing about using the fluent syntax is that it gets you used to working with expression syntax which is used for other things like Tasks, Predicates etc. so it's good way to get used to the syntax and be able to use it in other places in .NET.

+++ Rick ---

>Hi all, is the code below rewritable in non SQL like syntax
>
>
>int NumEmployees = 4;
>
>GridView1.DataSource = (from department in dbContext.Department
>                                    where department.Employee.Count > NumEmployees
>                                    orderby department.Name
>                                    select new
>                                    {
>                                        Name = department.Name ,
>                                        Employees = department.Employee // this is a collection.
>                                    }).ToList();
>
>
>just learning LINQ and wondered how to do this in the more dot way e.g obj.Where(x => x.Whatever == Whatever);
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform