SIGN UP MEMBER LOGIN:    
ARTICLE

Introduction to Dynamic Data Web Application Model: Part VI

Posted by Sateesh Arveti Articles | Learn .NET February 18, 2009
This article explains about interfacing Stored Procedures and Dynamic Data Entities Web Application template.
Reader Level:

In previous article, we had discussed about customization of page layout using DynamicControl. In this article, we will look into interfacing stored procedures with Dynamic Data followed by an introduction to Dynamic Data Entities Web Application template. Up to now, we are getting data directly from the tables and displaying it. But, most of the cases; we might need to write stored procedures for getting data from the tables.  Now, we look into mapping of stored procedures.

Open the solution used in previous article, go to pubs.dbml and drag-drop the SP getalltitles from Server Explorer as shown below:

Now, go to List.aspx and select GridDataSource [LINQDataSource] and select GridDataSource_Selecting event. Add the below code to the event:

PubsDataContext db = new PubsDataContext();

ISingleResult<getalltitlesResult> results = db.getalltitles();

e.Result = results.ToList();

e.Arguments.TotalRowCount = ((List<getalltitlesResult>)e.Result).Count;

Run the application.

Now, we look into Dynamic Data Entities Web Application template. Create a new VS 2008 project of this template with name as EntitiesSample. This template uses ADO.NET Entity framework and EntityDataSource internally. Whereas, previous template using LINQ to SQL and LinqDataSource for its data management. The structure of this template is similar to that of old template as shown below:

 

Now, add ADO.NET Entity Data model to the project with name as Pubs.edmx in the following way:

Select Project New Item  ADO.NET Entity Data Model Select from Database  Select Connection & Pubs Database Check Tables  Ok.

Select the appropriate tables and goto Global.asax.cs and uncomment model.RegisterContext statement and replace YourDataContextType with pubsEntities and make ScaffoldAllTables to true.

Run the application.

I am ending up this series here. I hope this series helped all to understand Dynamic Data template.

Login to add your contents and source code to this article
share this article :
post comment
 

Thanks alot...... This is a great article to know indepth about Dynamic Data Web Application Development......... Thanks again..........

Posted by Abhishek Mishra Jun 22, 2010
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Team Foundation Server Hosting
Become a Sponsor