.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Fauzul Azmi
Asad Ali
Post New Web Links

Dynamic LINQ Part 2 (Evolution)

Posted By: davidfowl     Posted Date: August 21, 2010    Points: 0   Category :ASP.Net
 

A while ago, Scott Gu blogged about a Dynamic LINQ library that was part of the C# samples in VS2008. This library let developers put together late bound LINQ queries using a special syntax. This really comes in handy when you want to build a LINQ query based on dynamic input. Consider the following example:

public ActionResult List(string sort) {
    var northwind = new NorthwindEntities();
    IQueryable<Product> products = northwind.Products;
    switch (sort) {
        case "ProductName":
            products = products.OrderBy(p => p.ProductName);
            br


View Complete Post


More Related Resource Links

Cutting Edge: Managing Dynamic Content Delivery In Silverlight, Part 2

  

This month Dino continues his look at managing dynamic Silverlight content by discussing caching and isolated storage.

Dino Esposito

MSDN Magazine February 2009


Cutting Edge: Managing Dynamic Content Delivery In Silverlight, Part 1

  

This month Dino tackles the problem of large download size for Silverlight applications, explaining when to use streaming, when to divide the download, and other techniques for better performance over the wire.

Dino Esposito

MSDN Magazine January 2009


Advanced Basics: The LINQ Enumerable Class, Part 2

  

This month Ken digs deeper into the System.Linq.Enumerable class and shows readers how to perform some magic data operations using System.Linq.Enumerable.

Ken Getz

MSDN Magazine September 2008


Advanced Basics: The LINQ Enumerable Class, Part 1.

  

Presented here is the LINQ Enumerable class, which allows you to manipulate data in any class that implements IEnumerable(Of T).

Ken Getz

MSDN Magazine July 2008


Map LINQ: Create Dynamic Maps with Visual Basic 9.0 and WPF

  

Scott Wisniewski uses Windows Presentation Foundation data binding along with LINQ and new XML features in Visual Basic to build an interactive app that maps demographic data.

Scott Wisniewski

MSDN Magazine December 2007


C# 3.0: The Evolution Of LINQ And Its Impact On The Design Of C#

  

LINQ gives allows developers to take advantage of the power of queries. Find out how it came to be.

Anson Horton

MSDN Magazine June 2007


Clay: malleable C# dynamic objects - part 2

  
In the first part of this post , I explained what requirements we have for the view models in Orchard and why we think dynamic is a good fit for such an object model. This time, we're going to look at Louis ' Clay library and how you can use it to create object graphs and consume them. But before we do that, I want to address a couple of questions. 1. If we use dynamic, aren't we losing IntelliSense and compile-time checking and all the good things that come with statically-typed languages? And is C# becoming overloaded with concepts, and trying to be good at everything but becoming good at nothing? Hush, hush, everything is going to be all right. Relax. Now think of all the XML/DOM styles of APIs that you know in .NET (or Java for that matter...(read more)

Clay: malleable C# dynamic objects - part 1: why we need it

  
When trying to build the right data structure in Orchard to contain a view model to which multiple entities blindly contribute, it became obvious pretty fast that using a dynamic structure of sorts was a must. What we needed was a hierarchical structure: a page can have a list of blog posts and a few widgets, each blog post is the composition of a number of parts such as comments, comments have authors, which can have avatars, ratings, etc. That gets us to the second requirement, which is that multiple entities that don't know about each other must contribute to building that object graph. We don't know the shape of the graph in advance and every node you build is susceptible to being expanded with new nodes. The problem is that C# static types...(read more)

Quick Note: Accessing Data in a SharePoint 2010 Web Part by using LINQ

  
In this exercise, you develop and deploy a visual Web Part that reads data from two lists by using a LINQ query and displays it in a DataGrid control.

Dynamic Class with Linq query Result

  
Hi, var   query = db.Customers.Where( "City == @0 and Orders.Count >= @1", "London", 10). OrderBy( "CompanyName"). Select( "New(CompanyName as Name, Phone)");    I am using this query as a sample which returns a dynamicclass type, and i need this should to converted to a list collections or datatable etc., As i am holding it in my wcf service with linqtosql as dataaccesslayer. Trying to send the results to the UI which i have consumes this service. Kindly help me in this. Thanks query = db.Customers

Dynamic where clause - Linq or SPQuery?

  
Has anyone tried to build a dynamic where clause in Linq to Sharepoint (i.e. search criterias are being modified at run time)? I think SPQuery/CAML is a better choice for this one..

Dynamic Linq query?

  
Please excuse my rookiness but is it possible to make a Linq query dynamic in the following pseduo code (to show what I'm trying to do)Dim objCustomoer = (From c In dc.CustomerLocation _ Where c.customerID = a1 _ And { c.zip = a2  OR  c.city = a3  OR  c.state = a4} _                             Select c).ToList() where a2 and a3  and a4 are being populated from user controls and only one will apply.  So query is done by state,  zip or by city, but not by more than one, so the other two would be null.  So the operator is really "OR" but I haven't found anything on a "or" or "whereOr" operator.  How can I accomplish this?

dynamic table name linq-to-sql query

  

I am writing a function in which i generate autocode in specific format i want to make this function generalize so that i send tablename and columnname  parameter and function return the next code. I am using linq to sql with MVC e.g. i want to make table name and column name dyanamic

from m in db.<tblnameparam> 
                       orderby m.<colnameparam> descending
                       select m.<colnameparam>



Linq to XML & ASP.Net - part 6

  
This is the sixth post in a new series of posts regarding LINQ to XML and ASP.Net.Please do read the first post here . You can find the second post here . You can find the third post here . You can read the fourth post here . You can find the fifth post here . In this post I would like to show on how to create a xml document on the fly and save it on a file in our local disk . I will use Visual Studio 2010 Ultimate edition and C# as the development language. Visual Studio 2010/2008 express editions...(read more)

Linq to XML & ASP.Net - part 5

  
This is the fifth post in a new series of posts regarding LINQ to XML and ASP.Net.Please do read the first post here . You can find the second post here . You can find the third post here . You can read the fourth post here . The xml file we are going to use in all these posts is the students.xml file. You can find the contents of this xml file in the first post. I will use Visual Studio 2010 Ultimate edition and C# as the development language. Visual Studio 2010/2008 express editions will suffice...(read more)

Linq to XML & ASP.Net - part 4

  
This is the fourth post in a new series of posts regarding LINQ to XML and ASP.Net.Please do read the first post here . You can find the second post here . You can find the third post here . The xml file we are going to use in all these posts is the students.xml file. You can find the contents of this xml file in the first post. I will use Visual Studio 2010 Ultimate edition and C# as the development language. Visual Studio 2010/2008 express editions will suffice. In this fourth post I will look...(read more)

Linq to XML & ASP.Net - part 3

  
This is the third post in a new series of posts regarding LINQ to XML and ASP.Net.Please do read the first post here . You can find the second article here . The xml file we are going to use in all these posts is the students.xml file. You can find the contents of this xml file in the first post. I will use Visual Studio 2010 Ultimate edition and C# as the development language. Visual Studio 2010/2008 express editions will suffice. In this third post I will look at how to "Read an element with a...(read more)
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend