SlideShare a Scribd company logo
1 of 34
Download to read offline
ASP.Net 3.5 SP1-
  Dynamic Data



Michał Morciniec – GPSD Spain
micham@microsoft.com
Agenda

• Dynamic Data
   – Concepts and Architecture
• Project creation in VS 2008 SP1
• Dynamic Data Website Elements
   – Page Templates, Page Modes
   – Field Tempates
• Customization
   – Custom Page Templates, Custom Field Templates
   – MetaData application, data validation
• Dynamic Data Wizard
Architecture


                                    Page and Field Templates

                                    Entities, Field,
                                                        Partial classes,
                                    Classes, Metadata   Attributes
   Tables, columns,
   constraints
                      LINQ to SQL




                                                                           Page generated
                                                                           dynamically
Data Source                          Data Model         Data Model
                                                        Meta-data
                                                        application
Dynamic Data Concepts

• Makes easy to create data driven web sites
  (operaciones CRUD)
• UI is inferred from the Data Model
• Data Model uses metadata to describe the structure
  and data relationships.
• Basic data validation rules are imposed automatically
• Pages are generated automatically based on
  templates
• URL Routing feature is used to map URLs to pages.
Dynamic Data WebSite – Creation 1

• Use template
  “Dynamic Data Web
  Site”



• Web Site Project
  contains “Dynamic
  Data” folder
Dynamic Data WebSite – Creation 2

• Add LINQ to SQL o
  LINQ to Entity
  classes to project



• Note - App_Code
  folder is added with
  the Data Model
  (.dbml)
Dynamic Data WebSite – Creation 3

• Create data
  connection, drag
  tables to designer of
  Data Model

• Data Model (classes )
  is generated in “code-
  behind” associatesd
  with the model
  (.designer.cs)
Dynamic Data WebSite – Creation 4

• Configure Data Model class (a.k.a.
  DataContext) in Global.asax in
  RegisterRoutes()

 MetaModel model=new MetaModel();
 model.RegisterContext(
        typeof(NorthwindDataContext),
        new ContextConfiguration()
        { ScaffoldAllTables = true }
 );
Dynamic Data-Creation DEMO
Page Templates

• Located in Dynamic
  DataPage Templates
• Page Uses Controls-
  –   DynamicDataManager
  –   DynamicValidator
  –   FilterRepeater
  –   DynamicControl
  –   DynamicField
• GridView used to show
  data.
Page Modes

• Separate-Page Mode (default)
   – Separate pages used to list, edit and insert new data
• Combined-Page Mode
   – Data is manipulated in the same page


• Different Page Modes can be associated with
  different tables (entities)
Separate-Page Mode

• Uses following route in Global.asax
   – {table}/{action}.
• {action} can be
   –   Edit      routes.Add(
   –   List        new DynamicDataRoute(quot;{table}/{action}.aspxquot;)
                    {
   –   Details        Constraints = new RouteValueDictionary(
                           new { action = quot;List|Details|Edit|Insertquot; }),
   –   Insert         Model = model
                      });



• Every operation uses different page
   – No “in-line” editing
Combined Page Mode

• Uses following routes in Global.asax
   – {table}/ListDetails.aspx
• Same page ListDetails.aspx used to
  manipulate data and show detail
   – “in-line” editing
            routes.Add(
              new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;)
              { Action = PageAction.List,
                 ViewName = quot;ListDetailsquot;,
                 Model = model
            });
            routes.Add(
              new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;)
                { Action = PageAction.Details,
                  ViewName = quot;ListDetailsquot;,
                  Model = model
            });
Page Modes combination

• Each entity can use its Page Mode:
• Order is significant
             routes.Add(
               new DynamicDataRoute(“Products/{action}.aspxquot;)
                {
                  Constraints = new RouteValueDictionary(
                         new { action = quot;List|Details|Edit|Insertquot; }),
                  Model = model,
                  Table = “Products”
                  });

             routes.Add(
               new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;)
               { Action = PageAction.List,
                 ViewName = quot;ListDetailsquot;,
                 Model = model
             });

             routes.Add(
               new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;)
                { Action = PageAction.Details,
                  ViewName = quot;ListDetailsquot;,
                  Model = model
             });
Field Templates

• Dynamic Data selects controls
  based on field datatype
   – Boolean shown as checkbox
   – Relationships shown as drop down list
   – Text show as TextBox or Literal
• Pages use Field Templates to
  show control at runtime
   – Controls do not form part of Page Template
     markup, injected at runtime
• FieldTemplates are stored in
  DynamicDataFieldTemplates
   – “Intrinsic types”
Field Templates

• Fields with unknown datatype are not displayed
• Atribute UIHint associates control with datatype
   – Substitute control for known datatype
   – Assign control for “unknown” datatype
• Field data is displayed using markup
   – <%# FieldValueString %>
   – <%# FieldValueEditString %> (edit mode)
Custom Page Templates

• Page Templates can be designed
• They follow naming convention
  – DynamicDataCustomPages{entity_name
    }PageName.aspx


• To associate page template
  ListDetails.aspx with table
  Suppliers store it in
  – DynamicDataCustomPagesSupplier
    sListDetails.aspx
Custom Page Templates

• Tipically, page markup contains DynamicField control
   – Concrete control for field is selected at runtime

                   <Columns>
                     <asp:DynamicField   DataField=quot;CompanyNamequot; />
                     <asp:DynamicField   DataField=quot;Phonequot; />
                     <asp:DynamicField   DataField=quot;Faxquot; />
                     <asp:DynamicField   DataField=quot;Productsquot; />
                   </Columns>


• Dynamic Data Engine maintains consistent URLs
   – Name of the customized page has to coincide with the “built-in”
     page names (ListDetails.aspx, Edit.aspx, List.aspx, etc.)
   – Same URL used to access customized and uncustomized pages
Custom Field Template

• It is possible to modify control associated with a datatype
   – Associate Calendar control with field of type Date
• New templates can be assigned to “unknown” datatypes
   – Use Image control for binary field.
• Custom Field Templates extend FieldTemplate
  UserControl
• Property FieldValue retrieves field data

       <asp:Calendar ID=quot;Calendar1quot; runat=quot;server“
         SelectedDate=quot;<%# (FieldValue!=null)? FieldValue:DateTime.Now %>quot;
         VisibleDate=quot;<%# (FieldValue!=null)? FieldValue:DateTime.Now %>quot;
       </asp:Calendar>
Custom Field Template-Edit Mode

• Use ExtractValues() to write control data to
  DB


      protected override void ExtractValues(IOrderedDictionary
      dictionary) {
      dictionary[Column.Name] =
          ConvertEditedValue(Calendar1.SelectedDate.ToShortDateString());
      }
MetaData application

• Dynamic Data uses MetaData specified in the Data Model
   – But when model is regenerated changes are lost
   – Define additional metadata in partial class

                                        using System;
                                        using System.ComponentModel.DataAnnotations;


                                        [MetadataType(typeof(EmployeeMetadata))]
                                        public partial class Employee
                                        {
                                        }


                                        public class EmployeeMetadata
                                        {
                                            [UIHint(quot;DateTimeCalendarquot;)]
                                            public object HireDate { get; set; }
                                        }
Data Validation

• Can use metadata
                                    public class CustomerMetadata {
   – [Required()]                      [Required()]
                                       public object Title;
                                     }
   – [Range(0,100)]


• Using validation events (Local)
   •   Pattern On<Field>Changing, On<Field>Changed
         public partial class Customer {
          partial void OnTitleChanging(string value) {
             if (!Char.IsUpper(value[0])) {
             throw new ValidationException(
               quot;Title must start with an uppercase letter.quot;);
             }
           }
         }
Data Validation

• Using Validate event (Global)
   – OnValidate fires on change for any field
   – You can filter on type on change
   (ChangeAction)
 public partial class Employee{
  partial void OnValidate(System.Data.Linq.ChangeAction action){
    if (action == System.Data.Linq.ChangeAction.Insert)) {
      if (this._BirthDate.Value.CompateTo(DateTime.Now)>0)
        throw new ValidationException(“The birth date cannot be
               in the future”);
    }
  }
 }
Customization-DEMO
Dynamic Data Wizard

• Facilitates creation of Dynamic Data web sites
• In development
   –   Not part of the .Net 3.5 SP1 RTM (not supported)
   –   Downloadable from CodePlex
   –   Requires SP1 of VS 2008
   –   Will not work with VS 2008 Express Ed.
Dynamic Data Wizard
Step1: Data Model

• Data Model
  – New Data Model generation
  – Can select existing model
Step2: Choose Entities for the Model
•   Table selection
•   Can specify Namespace
•   Can specify class name ( “DataContext” is appended)
•   LINQ to SQL or LINQ to Entities
Step3: Page Template Selection

• Wizard generates Custom Page Templates
  – Template for a list view (List)
  – for details (Details), adds Details link for each element in
    list view
  – For edition view (Edit)
  – New element (Insert)
Step4: Operation Customization

• Select/Restrict operations type
   – edition, insertion, deletion, details
• You can select fields for each view
Dynamic Data Wizard - Summary

• Data Model is generated (DataContext) and the Page
  Templates
• All Page Tempates go into CustomPages
   – Wizard does not use “standard” page templates
• Can select Fields to appear in each View and types of
  operations
Dynamic Data Wizard - DEMO
Summary

• Dynamic Data facilitates creation of data-driven web
  sites
   – Increases development productivity
   – Simplifies maintenance
   – Possibility of customization
• Dynamic Data Wizard still under development
References
•   Introduction to ASP.NET Dynamic Data-Dynamic Data in Action Webcasts
     – http://www.asp.net/dynamicdata/
•   Using ASP.NET Dynamic Data (MSDN)
     – http://msdn.microsoft.com/en-us/library/cc488545.aspx
•   Dynamic Data Futures (Source Code)
     – http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14475
•   Dynamic Data Wizard (Template for VS 2008 SP1)
     – http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14474
•   ASP .NET Dynamic Data (Video Links)
     – http://www.myvbprof.com/2007_Version/Dynamic_Data_Tutorial.aspx
•   ASP .NET Dynamic Data Attributes
     – http://blogs.msdn.com/mairaw/archive/2008/04/24/dynamic-data-attributes.aspx

More Related Content

What's hot

ASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationRandy Connolly
 
Datasource in asp.net
Datasource in asp.netDatasource in asp.net
Datasource in asp.netSireesh K
 
Agile Data concept introduction
Agile Data   concept introductionAgile Data   concept introduction
Agile Data concept introductionRomans Malinovskis
 
Templates
TemplatesTemplates
Templatessoon
 
ASP.NET MVC Controllers & Actions
ASP.NET MVC Controllers & ActionsASP.NET MVC Controllers & Actions
ASP.NET MVC Controllers & Actionsonsela
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its featuresAbhishek Sur
 
Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Erik-Berndt Scheper
 
Managing state in asp.net
Managing state in asp.netManaging state in asp.net
Managing state in asp.netSireesh K
 
For Beginners - Ado.net
For Beginners - Ado.netFor Beginners - Ado.net
For Beginners - Ado.netTarun Jain
 
Developing Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal ReportsDeveloping Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal ReportsChad Petrovay
 
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...Oleksandr Tarasenko
 
How Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill SetsHow Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill SetsChad Petrovay
 
Introducing DataWave
Introducing DataWaveIntroducing DataWave
Introducing DataWaveData Works MD
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NETrchakra
 

What's hot (20)

ASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And RepresentationASP.NET 08 - Data Binding And Representation
ASP.NET 08 - Data Binding And Representation
 
Datasource in asp.net
Datasource in asp.netDatasource in asp.net
Datasource in asp.net
 
Agile Data concept introduction
Agile Data   concept introductionAgile Data   concept introduction
Agile Data concept introduction
 
For Beginers - ADO.Net
For Beginers - ADO.NetFor Beginers - ADO.Net
For Beginers - ADO.Net
 
Templates
TemplatesTemplates
Templates
 
Ajax and Jquery
Ajax and JqueryAjax and Jquery
Ajax and Jquery
 
ASP.NET MVC Controllers & Actions
ASP.NET MVC Controllers & ActionsASP.NET MVC Controllers & Actions
ASP.NET MVC Controllers & Actions
 
Introduction to XAML and its features
Introduction to XAML and its featuresIntroduction to XAML and its features
Introduction to XAML and its features
 
Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?Big Data processing with Spark, Scala or Java?
Big Data processing with Spark, Scala or Java?
 
Managing state in asp.net
Managing state in asp.netManaging state in asp.net
Managing state in asp.net
 
For Beginners - Ado.net
For Beginners - Ado.netFor Beginners - Ado.net
For Beginners - Ado.net
 
Developing Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal ReportsDeveloping Dynamic Reports for TMS Using Crystal Reports
Developing Dynamic Reports for TMS Using Crystal Reports
 
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
 
How Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill SetsHow Clean is your Database? Data Scrubbing for all Skill Sets
How Clean is your Database? Data Scrubbing for all Skill Sets
 
Introducing DataWave
Introducing DataWaveIntroducing DataWave
Introducing DataWave
 
ADO.NET
ADO.NETADO.NET
ADO.NET
 
Chap14 ado.net
Chap14 ado.netChap14 ado.net
Chap14 ado.net
 
Managing states
Managing statesManaging states
Managing states
 
Introduction to ADO.NET
Introduction to ADO.NETIntroduction to ADO.NET
Introduction to ADO.NET
 
Ado.net
Ado.netAdo.net
Ado.net
 

Viewers also liked

Co-Creation en creatieve industrie
Co-Creation en creatieve industrieCo-Creation en creatieve industrie
Co-Creation en creatieve industrieVRmaster
 
Proevenaancreativiteit6cs
Proevenaancreativiteit6csProevenaancreativiteit6cs
Proevenaancreativiteit6csVRmaster
 
Tanie®
Tanie®Tanie®
Tanie®tanie
 
Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015
Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015
Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015VRmaster
 
There's an app for that
There's an app for thatThere's an app for that
There's an app for thatVRmaster
 
Isaac Explorer Report
Isaac Explorer ReportIsaac Explorer Report
Isaac Explorer ReportBrooke Young
 
Voorbeelden van vouwwerk
Voorbeelden van vouwwerkVoorbeelden van vouwwerk
Voorbeelden van vouwwerkVRmaster
 
Brittany Explorer Report
Brittany Explorer ReportBrittany Explorer Report
Brittany Explorer ReportBrooke Young
 
Week 2 Chapter 17 - Decisions
Week 2 Chapter 17 - DecisionsWeek 2 Chapter 17 - Decisions
Week 2 Chapter 17 - Decisionswayneholly
 
Alyssa Explorer Report
Alyssa Explorer ReportAlyssa Explorer Report
Alyssa Explorer ReportBrooke Young
 
Barkha Talent Acquisition Talent Retention
Barkha Talent Acquisition   Talent RetentionBarkha Talent Acquisition   Talent Retention
Barkha Talent Acquisition Talent RetentionBarkha_Sharma
 
Tsm Direct Sales Package 2009
Tsm Direct Sales Package 2009Tsm Direct Sales Package 2009
Tsm Direct Sales Package 2009Keith Dennison
 
Sociale media ICT brabant
Sociale media ICT brabantSociale media ICT brabant
Sociale media ICT brabantVRmaster
 

Viewers also liked (20)

Seminarie Leven
Seminarie LevenSeminarie Leven
Seminarie Leven
 
Medicaid Presentation Appledorn090518
Medicaid Presentation Appledorn090518Medicaid Presentation Appledorn090518
Medicaid Presentation Appledorn090518
 
Co-Creation en creatieve industrie
Co-Creation en creatieve industrieCo-Creation en creatieve industrie
Co-Creation en creatieve industrie
 
Proevenaancreativiteit6cs
Proevenaancreativiteit6csProevenaancreativiteit6cs
Proevenaancreativiteit6cs
 
Tanie®
Tanie®Tanie®
Tanie®
 
Pp Mappe 3
Pp Mappe 3Pp Mappe 3
Pp Mappe 3
 
Haskell
HaskellHaskell
Haskell
 
Bryan Kim Report
Bryan Kim ReportBryan Kim Report
Bryan Kim Report
 
Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015
Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015
Virtual reality voor mkb, presentatie Brabant Onderneemt, november 2015
 
There's an app for that
There's an app for thatThere's an app for that
There's an app for that
 
Elevator Up Software Licensing Issues Checklist
Elevator Up Software Licensing Issues ChecklistElevator Up Software Licensing Issues Checklist
Elevator Up Software Licensing Issues Checklist
 
Isaac Explorer Report
Isaac Explorer ReportIsaac Explorer Report
Isaac Explorer Report
 
Six Tips For Starting A Business Fast Track 090707
Six Tips For Starting A Business Fast Track 090707Six Tips For Starting A Business Fast Track 090707
Six Tips For Starting A Business Fast Track 090707
 
Voorbeelden van vouwwerk
Voorbeelden van vouwwerkVoorbeelden van vouwwerk
Voorbeelden van vouwwerk
 
Brittany Explorer Report
Brittany Explorer ReportBrittany Explorer Report
Brittany Explorer Report
 
Week 2 Chapter 17 - Decisions
Week 2 Chapter 17 - DecisionsWeek 2 Chapter 17 - Decisions
Week 2 Chapter 17 - Decisions
 
Alyssa Explorer Report
Alyssa Explorer ReportAlyssa Explorer Report
Alyssa Explorer Report
 
Barkha Talent Acquisition Talent Retention
Barkha Talent Acquisition   Talent RetentionBarkha Talent Acquisition   Talent Retention
Barkha Talent Acquisition Talent Retention
 
Tsm Direct Sales Package 2009
Tsm Direct Sales Package 2009Tsm Direct Sales Package 2009
Tsm Direct Sales Package 2009
 
Sociale media ICT brabant
Sociale media ICT brabantSociale media ICT brabant
Sociale media ICT brabant
 

Similar to ASP.Net Dynamic Data Site

Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvcmicham
 
Building Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel AppelBuilding Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel Appel.NET Conf UY
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...goodfriday
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc trainingicubesystem
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRPeter Elst
 
Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagWebtrends
 
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...Inhacking
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08Vivek chan
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0Korhan Bircan
 
Data Binding - Android by Harin Trivedi
Data Binding - Android by Harin TrivediData Binding - Android by Harin Trivedi
Data Binding - Android by Harin Trivediharintrivedi
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi Juhola
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2fishwarter
 
Fly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using AngularFly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using AngularVacation Labs
 

Similar to ASP.Net Dynamic Data Site (20)

Asp.Net Mvc
Asp.Net MvcAsp.Net Mvc
Asp.Net Mvc
 
Building Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel AppelBuilding Modern Websites with ASP.NET by Rachel Appel
Building Modern Websites with ASP.NET by Rachel Appel
 
Asp.NET MVC
Asp.NET MVCAsp.NET MVC
Asp.NET MVC
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc training
 
ASP.NET Lecture 4
ASP.NET Lecture 4ASP.NET Lecture 4
ASP.NET Lecture 4
 
Introduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIRIntroduction to SQLite in Adobe AIR
Introduction to SQLite in Adobe AIR
 
Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 Tag
 
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...SE2016 Android Mikle Anokhin "Speed up application development with data bind...
SE2016 Android Mikle Anokhin "Speed up application development with data bind...
 
06 asp.net session08
06 asp.net session0806 asp.net session08
06 asp.net session08
 
Core Data with Swift 3.0
Core Data with Swift 3.0Core Data with Swift 3.0
Core Data with Swift 3.0
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
Data Binding - Android by Harin Trivedi
Data Binding - Android by Harin TrivediData Binding - Android by Harin Trivedi
Data Binding - Android by Harin Trivedi
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
Fly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using AngularFly High With Angular - How to build an app using Angular
Fly High With Angular - How to build an app using Angular
 

Recently uploaded

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 

Recently uploaded (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 

ASP.Net Dynamic Data Site

  • 1. ASP.Net 3.5 SP1- Dynamic Data Michał Morciniec – GPSD Spain micham@microsoft.com
  • 2. Agenda • Dynamic Data – Concepts and Architecture • Project creation in VS 2008 SP1 • Dynamic Data Website Elements – Page Templates, Page Modes – Field Tempates • Customization – Custom Page Templates, Custom Field Templates – MetaData application, data validation • Dynamic Data Wizard
  • 3. Architecture Page and Field Templates Entities, Field, Partial classes, Classes, Metadata Attributes Tables, columns, constraints LINQ to SQL Page generated dynamically Data Source Data Model Data Model Meta-data application
  • 4. Dynamic Data Concepts • Makes easy to create data driven web sites (operaciones CRUD) • UI is inferred from the Data Model • Data Model uses metadata to describe the structure and data relationships. • Basic data validation rules are imposed automatically • Pages are generated automatically based on templates • URL Routing feature is used to map URLs to pages.
  • 5. Dynamic Data WebSite – Creation 1 • Use template “Dynamic Data Web Site” • Web Site Project contains “Dynamic Data” folder
  • 6. Dynamic Data WebSite – Creation 2 • Add LINQ to SQL o LINQ to Entity classes to project • Note - App_Code folder is added with the Data Model (.dbml)
  • 7. Dynamic Data WebSite – Creation 3 • Create data connection, drag tables to designer of Data Model • Data Model (classes ) is generated in “code- behind” associatesd with the model (.designer.cs)
  • 8. Dynamic Data WebSite – Creation 4 • Configure Data Model class (a.k.a. DataContext) in Global.asax in RegisterRoutes() MetaModel model=new MetaModel(); model.RegisterContext( typeof(NorthwindDataContext), new ContextConfiguration() { ScaffoldAllTables = true } );
  • 10. Page Templates • Located in Dynamic DataPage Templates • Page Uses Controls- – DynamicDataManager – DynamicValidator – FilterRepeater – DynamicControl – DynamicField • GridView used to show data.
  • 11. Page Modes • Separate-Page Mode (default) – Separate pages used to list, edit and insert new data • Combined-Page Mode – Data is manipulated in the same page • Different Page Modes can be associated with different tables (entities)
  • 12. Separate-Page Mode • Uses following route in Global.asax – {table}/{action}. • {action} can be – Edit routes.Add( – List new DynamicDataRoute(quot;{table}/{action}.aspxquot;) { – Details Constraints = new RouteValueDictionary( new { action = quot;List|Details|Edit|Insertquot; }), – Insert Model = model }); • Every operation uses different page – No “in-line” editing
  • 13. Combined Page Mode • Uses following routes in Global.asax – {table}/ListDetails.aspx • Same page ListDetails.aspx used to manipulate data and show detail – “in-line” editing routes.Add( new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;) { Action = PageAction.List, ViewName = quot;ListDetailsquot;, Model = model }); routes.Add( new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;) { Action = PageAction.Details, ViewName = quot;ListDetailsquot;, Model = model });
  • 14. Page Modes combination • Each entity can use its Page Mode: • Order is significant routes.Add( new DynamicDataRoute(“Products/{action}.aspxquot;) { Constraints = new RouteValueDictionary( new { action = quot;List|Details|Edit|Insertquot; }), Model = model, Table = “Products” }); routes.Add( new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;) { Action = PageAction.List, ViewName = quot;ListDetailsquot;, Model = model }); routes.Add( new DynamicDataRoute(quot;{table}/ListDetails.aspxquot;) { Action = PageAction.Details, ViewName = quot;ListDetailsquot;, Model = model });
  • 15. Field Templates • Dynamic Data selects controls based on field datatype – Boolean shown as checkbox – Relationships shown as drop down list – Text show as TextBox or Literal • Pages use Field Templates to show control at runtime – Controls do not form part of Page Template markup, injected at runtime • FieldTemplates are stored in DynamicDataFieldTemplates – “Intrinsic types”
  • 16. Field Templates • Fields with unknown datatype are not displayed • Atribute UIHint associates control with datatype – Substitute control for known datatype – Assign control for “unknown” datatype • Field data is displayed using markup – <%# FieldValueString %> – <%# FieldValueEditString %> (edit mode)
  • 17. Custom Page Templates • Page Templates can be designed • They follow naming convention – DynamicDataCustomPages{entity_name }PageName.aspx • To associate page template ListDetails.aspx with table Suppliers store it in – DynamicDataCustomPagesSupplier sListDetails.aspx
  • 18. Custom Page Templates • Tipically, page markup contains DynamicField control – Concrete control for field is selected at runtime <Columns> <asp:DynamicField DataField=quot;CompanyNamequot; /> <asp:DynamicField DataField=quot;Phonequot; /> <asp:DynamicField DataField=quot;Faxquot; /> <asp:DynamicField DataField=quot;Productsquot; /> </Columns> • Dynamic Data Engine maintains consistent URLs – Name of the customized page has to coincide with the “built-in” page names (ListDetails.aspx, Edit.aspx, List.aspx, etc.) – Same URL used to access customized and uncustomized pages
  • 19. Custom Field Template • It is possible to modify control associated with a datatype – Associate Calendar control with field of type Date • New templates can be assigned to “unknown” datatypes – Use Image control for binary field. • Custom Field Templates extend FieldTemplate UserControl • Property FieldValue retrieves field data <asp:Calendar ID=quot;Calendar1quot; runat=quot;server“ SelectedDate=quot;<%# (FieldValue!=null)? FieldValue:DateTime.Now %>quot; VisibleDate=quot;<%# (FieldValue!=null)? FieldValue:DateTime.Now %>quot; </asp:Calendar>
  • 20. Custom Field Template-Edit Mode • Use ExtractValues() to write control data to DB protected override void ExtractValues(IOrderedDictionary dictionary) { dictionary[Column.Name] = ConvertEditedValue(Calendar1.SelectedDate.ToShortDateString()); }
  • 21. MetaData application • Dynamic Data uses MetaData specified in the Data Model – But when model is regenerated changes are lost – Define additional metadata in partial class using System; using System.ComponentModel.DataAnnotations; [MetadataType(typeof(EmployeeMetadata))] public partial class Employee { } public class EmployeeMetadata { [UIHint(quot;DateTimeCalendarquot;)] public object HireDate { get; set; } }
  • 22. Data Validation • Can use metadata public class CustomerMetadata { – [Required()] [Required()] public object Title; } – [Range(0,100)] • Using validation events (Local) • Pattern On<Field>Changing, On<Field>Changed public partial class Customer { partial void OnTitleChanging(string value) { if (!Char.IsUpper(value[0])) { throw new ValidationException( quot;Title must start with an uppercase letter.quot;); } } }
  • 23. Data Validation • Using Validate event (Global) – OnValidate fires on change for any field – You can filter on type on change (ChangeAction) public partial class Employee{ partial void OnValidate(System.Data.Linq.ChangeAction action){ if (action == System.Data.Linq.ChangeAction.Insert)) { if (this._BirthDate.Value.CompateTo(DateTime.Now)>0) throw new ValidationException(“The birth date cannot be in the future”); } } }
  • 25. Dynamic Data Wizard • Facilitates creation of Dynamic Data web sites • In development – Not part of the .Net 3.5 SP1 RTM (not supported) – Downloadable from CodePlex – Requires SP1 of VS 2008 – Will not work with VS 2008 Express Ed.
  • 27. Step1: Data Model • Data Model – New Data Model generation – Can select existing model
  • 28. Step2: Choose Entities for the Model • Table selection • Can specify Namespace • Can specify class name ( “DataContext” is appended) • LINQ to SQL or LINQ to Entities
  • 29. Step3: Page Template Selection • Wizard generates Custom Page Templates – Template for a list view (List) – for details (Details), adds Details link for each element in list view – For edition view (Edit) – New element (Insert)
  • 30. Step4: Operation Customization • Select/Restrict operations type – edition, insertion, deletion, details • You can select fields for each view
  • 31. Dynamic Data Wizard - Summary • Data Model is generated (DataContext) and the Page Templates • All Page Tempates go into CustomPages – Wizard does not use “standard” page templates • Can select Fields to appear in each View and types of operations
  • 33. Summary • Dynamic Data facilitates creation of data-driven web sites – Increases development productivity – Simplifies maintenance – Possibility of customization • Dynamic Data Wizard still under development
  • 34. References • Introduction to ASP.NET Dynamic Data-Dynamic Data in Action Webcasts – http://www.asp.net/dynamicdata/ • Using ASP.NET Dynamic Data (MSDN) – http://msdn.microsoft.com/en-us/library/cc488545.aspx • Dynamic Data Futures (Source Code) – http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14475 • Dynamic Data Wizard (Template for VS 2008 SP1) – http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=14474 • ASP .NET Dynamic Data (Video Links) – http://www.myvbprof.com/2007_Version/Dynamic_Data_Tutorial.aspx • ASP .NET Dynamic Data Attributes – http://blogs.msdn.com/mairaw/archive/2008/04/24/dynamic-data-attributes.aspx