1 / 16

RAD Web Applications with ASP.NET Dynamic Data

RAD Web Applications with ASP.NET Dynamic Data. Ingo Rammer ingo.rammer@thinktecture.com. Ingo Rammer and thinktecture . Support and consulting for software architects and developers Application Optimization, Troubleshooting, Debugging Architectural Consulting and Prototyping

pravat
Download Presentation

RAD Web Applications with ASP.NET Dynamic Data

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RAD Web Applications with ASP.NET Dynamic Data Ingo Rammeringo.rammer@thinktecture.com

  2. Ingo Rammer and thinktecture • Support and consulting for software architects and developers • Application Optimization, Troubleshooting, Debugging • Architectural Consulting and Prototyping • Developer-Coaching and -Mentoring • Architecture and Code Reviews • http://www.thinktecture.com • ingo.rammer@thinktecture.com

  3. ASP.NET Dynamic Data • Customizable model/class-driven frontend technology • Today: Linq-to-SQL and Entity Framework • Scaffolding • Highly customizable • But more important: • Dynamic Data Controls

  4. Customizable Scaffolding • Scaffolding – Automatic Form Generation • Customizable UI („No Limits“ – it‘s all .NET) • Configurable MVC-style URL routing • Default: Querystring, but can be changed to routing like: • http://server/Customers • http://server/Customers/ALFKI • http://server/Customers/ALFKI/Edit • ... or any other routing you can imagine

  5. Extensibility • Extension Model for logical schema (Entity Framework or Linq-to-SQL) • Validation • Business Rules • Sorting, Filtering, Edit, Insert, Delete • .NET Framework 3.5 SP1 (+ Hotfix)

  6. Scaffolding • The first thing you‘ll see at every demo • Zero code data forms (but still: customizable whenever you want!) • Simply uncomment the following line • This enables scaffolding for all entities // Global.asax in Application_Start model.RegisterContext (typeof(NorthwindEntities), new ContextConfiguration() { ScaffoldAllTables = true });

  7. Restricted Scaffolding • Attributes on a class-level or field level • Field level supports metadata-redirection with [MetadataType] [ScaffoldTable(true)] [MetadataType(typeof(ProductsMetaData))] public partial class Products { } public class ProductsMetaData { [ScaffoldColumn(true)] public object Name; }

  8. Customizating Templates • Templates • Page Templates („all List Pages“, „all Detail pages“) • Field Templates („all Integer TextBoxes“) • Custom Pages • Use a particular ASP.Net page for List,Detail,Edit and/or Insert • Can be done globally or configured with routing • Can use DynamicField/DynamicControl with UIHints on them

  9. Creating a Custom Page • Simply create a folder in CustomPages named like your entity and copy/paste one of the existing ASPX pages • Create a folder name with the exact same name as your entity class • Copy and paste the desired ASPX file from PageTemplates to CustomPages/EntityName • Done! (no configuration necessary)

  10. Sample Custom Page <asp:DetailsView DataSourceID="DetailsDataSource" AutoGenerateRows="false"> <Fields> <asp:DynamicField DataField="ProductName" /> <asp:DynamicField DataField="QuantityPerUnit" HeaderText ="Quantity" /> <asp:DynamicField DataField="UnitPrice" /> <asp:DynamicField DataField="UnitsInStock" /> <asp:DynamicField DataField="Categories" /> <asp:TemplateField> <HeaderTemplate>Name</HeaderTemplate> <ItemTemplate> Templated: <asp:DynamicControl runat="server" DataField="ProductName" /> </ItemTemplate> </asp:TemplateField> </Fields> <asp:DetailsView>

  11. Customizing the Model • [UIHint]: Use a certain control for a field • [DataType]: custom type (it’s just a string) which can later be used by the field template („EmailAddress“, „Url“) • [DisplayFormat]: Use a certain format string for one field • [DisplayField]: Use this column for foreign key values of this table (ex: display the field „Name“ for Customers) • And more: Whatever you want/need to later check in a custom input control. Create custom Attributes as needed

  12. Custom Fields • Create a ASCX in /FieldTemplates, derive from FieldTemplateUserControl and override DataControl • Possible: • Override FormatFieldValue, ExtractValues • Use MetaDataAttribute. TypeOf<T>() to get access to attributes defined on the field in the model

  13. Embedding DD • Using DynamicData on an unrelated ASPX page • Hint: It's just like the custom page! • Create a DataSource, Parameters, DetailView, GridView or ListView and you're ready to go ...

  14. In-Depth Customization • There are hardly any limits, DD fits very nicely with ASP.NET • You‘ve already seen: custom fields, custom pages • Missing pieces is: which fields get displayed, in what order? • IAutoFieldGenerator: specifies which fields should be displayed

  15. Future • Preview can be downloaded (ASP.NET Dynamic Data 4.0 Preview 2) • Different data access layers • ASP.NET Data Services & custom data layers • Query Blocks • Filtering with LINQ Expressions • Additional Field Templates (Enum, Email, Url)

More Related