Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2010, 03:21 PM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default Questions about EntityDataSource and dynamic binding

Hello,

I was re-reading the chapter 14 of beginning asp.net in C# and vb and i was wondering about the EntityDataSource. I have some questions.

1- It is best pratices to use EntityDataSource or bind dynamically using LINQ with a GridView.

2- Is EntityDataSource working with LINQ for querying ? (SELECT data)

3- Is there a way too add insert, update features using LINQ with the EntityDataSource ? or it is done automatically ?

Big thanks!
 
Old November 22nd, 2010, 06:21 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rushino,

Quote:
1- It is best pratices to use EntityDataSource or bind dynamically using LINQ with a GridView.
It all depends.The data source can be an easy control to use for many scenarios. However, in other cases where you have complex querying logic, it may be easier to use a LINQ queryt.

Quote:
2- Is EntityDataSource working with LINQ for querying ? (SELECT data)
If I understand thw question correctly: yes; it has select parameters that enable you to create a query.

Quote:
3- Is there a way too add insert, update features using LINQ with the EntityDataSource ? or it is done automatically ?
Not sure I understand this question. What would you like to add?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 
Old November 22nd, 2010, 09:01 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default

Hello Imar,

Again a big thanks for your reply and sorry because i may not have been that clear.

About question 1.

I asked if it was best practice due to fact that i had problems using dynamic declarative binding. My principal concern is about hte place where we should set up dynamic declarative binding. What is the best place to put the dynamic binding ? in which event ?.. cause sometimes i end up having no data in a GridView.. before doing some operations on the data itself.

About question 2.

I was wondering if the underlying query in an EntityDataSource was using LINQ instead of regular SQL. Or it is regular SQL ? Can you write a LINQ query directly in the select command of the datasource in the aspx. page ?

About question 3.

Does that EntityDataSource support aswell insert, update and delete query with LINQ ?

Thanks.
 
Old November 22nd, 2010, 09:55 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Rushino,

1) For simple scenarios, the data source works fine. For more complex queries, I find LINQ queries in Code Behind easier to work with. You typivally do it in Page_Load.

2) Yes, it uses LINQ. The Where and Select properties enable you to define LINQ. For an example, see the file ManagePhotoAlbum.aspx. This LINQ query is then translated to SQL.

3) The technical answer is: yes. Since a standard EDS uses LINQ, it supports inserting, updating and deleting data. However, in reality the answer is probably no, as the control isn't very good in working with data coming from a complex query. For those scenarios, hand coding is a lot easier. This is explained on page 554 and further.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
The Following User Says Thank You to Imar For This Useful Post:
Rushino (November 22nd, 2010)
 
Old November 22nd, 2010, 09:58 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
Default

Alright. Big thanks for these replies. Its all clear now.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to achieve dynamic binding li72 XSLT 3 February 21st, 2008 11:46 AM
Dynamic Binding in Report Viewer ritesh2381 ASP.NET 2.0 Professional 0 November 19th, 2007 07:29 AM
VB6 ADO Dynamic Data Binding Question pad Pro VB Databases 1 January 28th, 2005 10:43 PM
Crystal Reports Dynamic binding field objects velkropie Crystal Reports 0 December 1st, 2004 12:21 AM
Crystal Reports Dynamic binding field objects velkropie BOOK: Professional Crystal Reports for VS.NET 0 November 30th, 2004 11:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.