O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data Operations with EF Entities

To get you started querying against EF entities, we’ll dive right into some C#-based examples.

Querying Entity Data Using LINQ to Entities

Returning to your WPF example project, open the source file MainWindow.xaml in the XAML designer. Using the Toolbox window, click and drag a Button and drop it onto the window next the existing button. Name this button btnEntitySelect1, then double-click it to generate its Click event handler code in MainWindow.xaml.cs, and then add the code in Listing 47.7 to btnEntitySelect1_Click.

LISTING 47.7 Using LINQ to Entities to Bind Data to a WPF DataGrid

private void btnEntitySelect1_Click(object sender,RoutedEventArgs e){  AdventureWorks2012Entities ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required