PC30: ASP.NET Dynamic Data

peruvianwageslaveInternet and Web Development

Feb 5, 2013 (4 years and 8 months ago)

96 views



Scott Hunter


Program Manager


Microsoft Corporation

PC30

















//
Global.asax
:
Application_Start

model.RegisterContext

(
typeof
(
NorthwindDataContext
),


new
ContextConfiguration
() {
ScaffoldAllTables

= true });

// WARNING: This enables scaffolding for every table in the model. To enable
scaffolding on a per
-
table or per
-
column basis, you can use attributes on the model:


[
MetadataType
(
typeof
(
ProductMeta
))]

public partial class
ProductMeta

[
ScaffoldTable
(true)]



{

public partial class Product



[
ScaffoldColumn
(true)]

{





public object
UnitPrice

{ get; set; }






}

}


//
Global.asax
:
Application_Start


RouteTable.Routes.routes.Add

(new
DynamicDataRoute
("{table}/{action}.
aspx
") {


Constraints = new
RouteValueDictionary
(new { action =
"
List|Details|Edit|Insert
" }),


Model = model

});


RouteTable.Routes.routes.Add

(new
DynamicDataRoute
("{table}/List.aspx")
{


Action =
PageAction.List
,


ViewName

= "List",


Model = model

});


RouteTable.Routes.Add
(new
DynamicDataRoute
("
MyCategoryDetail
/{
CategoryID
}") {


Model = model,


Table = "Categories",


Action = "Details"

});



PageTemplates

FieldTemplates

UIHint
/
DataType

on Model


CustomPages

UIHints

on
DynamicField
/
DynamicControl










































































http://www.asp.net/dynamicdata

http://www.codeplex.com/aspnet

http://blogs.msdn.com/davidebb/

http://blogs.msdn.com/marcinon/

http://blogs.msdn.com/scothu/

http://weblogs.asp.net/scottgu

http://www.hanselman.com/blog/
www.microsoftpdc.com

©
2008 Microsoft
Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademar
ks
and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the
dat
e of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accu
rac
y of any information provided after the date of this presentation.

MICROSOFT
MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.