Converting query expression to Linq method syntax?

The lambda expression should look like: var contentsAuthor = context. CmsContents . Join(context.

CmsAuthors, content => content. AuthorId, author => author. AuthorId, (content, author) => new { content, author }) .

Where(x => x.author. UserId == userGuid) . Select(x => new { x.content.

Title, x.content. ContentId }) Both yours and this version are LINQ queries. This one uses lambdas directly whereas your version uses syntactic sugar available in C#.

They are the same. LINQ-to-Entities have nothing to do with this Anyway if you are using LINQ-to-Entities your CmsContent should have Author property and your query would reduce to: var contentsAuthor = context. CmsContents .

Where(c => c.Author. UserId == userGuid) . Select(c => new { c.

Title, c. ContentId }) The LINQ-to-Entities provider will make join for you when translating expression tree to SQL query.

The lambda expression should look like: var contentsAuthor = context. CmsContents . Join(context.

CmsAuthors, content => content. AuthorId, author => author. AuthorId, (content, author) => new { content, author }) .

Where(x => x.author. UserId == userGuid) . Select(x => new { x.content.

Title, x.content. ContentId }); Both yours and this version are LINQ queries. This one uses lambdas directly whereas your version uses syntactic sugar available in C#.

They are the same. LINQ-to-Entities have nothing to do with this. Anyway if you are using LINQ-to-Entities your CmsContent should have Author property and your query would reduce to: var contentsAuthor = context.

CmsContents . Where(c => c.Author. UserId == userGuid) .

Select(c => new { c. Title, c. ContentId }); The LINQ-to-Entities provider will make join for you when translating expression tree to SQL query.

Thanks Ladislav for your explanation! – GibboK Sep 29 at 12:12 So with LINQ-To-Entities means I can retrive the data working with the MODEL (so Navigational properties and so on).. correct? Thnks – GibboK Sep 29 at 12:16 1 LINQ-to-Entities means that you are querying entity model and LINQ provider is converting your queries to SQL.

– Ladislav Mrnka Sep 29 at 12:19 thanks Ladislav now is clear. Have a nice day – GibboK Sep 29 at 12:23.

Lambda: var contentsAuthor = context. CmsContents . Join(context.

CmsAuthors, c => c. AuthorId, a => a. AuthorId, (c, a) => new { Contents = c, Author = a }) .

Where(w => w.Author. UserId == userGuid) . Select(s => new { s.Contents.

Title, s.Contents. ContentId }); The way you did it is fine though. I call it query syntax, but I'm not sure if it has an official name.

For this sort of stuff, check out LINQPad. In "Expression" mode, you can type a query like you have, and click on the Lambda symbol and it'll show you the lambda version of your query.

Language-Integrated Query (LINQ) is the name for a set of technologies based on the integration of query capabilities directly into the C# language (also in Visual Basic and potentially any other . With LINQ, a query is now a first-class language construct, just like classes, methods, events and so on. For a developer who writes queries, the most visible "language-integrated" part of LINQ is the query expression.

Query expressions are written in a declarative query syntax introduced in C# 3.0. By using query syntax, you can perform even complex filtering, ordering, and grouping operations on data sources with a minimum of code. You use the same basic query expression patterns to query and transform data in SQL databases, ADO.

NETÂ Datasets, XML documents and streams, and . The following example shows the complete query operation. The complete operation includes creating a data source, defining the query expression, and executing the query in a foreach statement.

For more information about the basics of LINQ in C#, see Getting Started with LINQ in C#.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions