Your SlideShare is downloading. ×
ASP.NET Dynamic Data
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

ASP.NET Dynamic Data

1,889

Published on

My presentation on ASP.NET Dynamic Data which is a new feature in the .NET Framework 3.5 SP 1 and allows for data driven websites to easily be constructed.

My presentation on ASP.NET Dynamic Data which is a new feature in the .NET Framework 3.5 SP 1 and allows for data driven websites to easily be constructed.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,889
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
27
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • PrepOpen Visual StudioOpen SQL Server Management StudioMake sure have v1 of the databaseHave ZoomIT running
  • In VS 2008 -> new website -> 3.5 Framework (point this out) -> Dynamic Data Web ApplicationServer Explorer -> Add new connection -> SQL database (make sure you select the sql client) -> Expand/Show databaseSolution Explorer -> Add new item -> LINQ to SQL classes -> Call it spacedataDrag the tables from the server explorer onto the LINQ to SQL design surface -> SaveOpen the SpaceData.design.cs file -> Show the fact it’s a partial class (good spot quiz time) -> and the attributesOpenglobal.asax -> Uncomment the line beginning with model.RegisterContext,Set the context to SpaceDataDataContextand set scaffold all tables to true.RUN!Things to show:It’s not very prettyUnder astronauts the ID is showing, explain that we haven’t told it anything about itShow an editShow an insert and it’s spectacular fail;Paging/Sorting/Results per pageURL naming structureStop the app, and in the global.asax comment out the first route and un-comment the second route. Run the demo again: AJAX!!!!Last stop the app, remove scaffolding all and run again – errors!*
  • Stop the demo -> Add existingfile -> SpaceDataMetadata.csPoint out the classes are partial and have been annotated. Re-run the app and note that only the tables we want shown are.Next explain about the issue caused by not being able to overload propertiesCreate private class within the public class and add a property in it for ID and Name. Set to object type, explain why that works and how it is helpful.Attribute ID with ScaffoldColumn(false) (since the DB will handle this) and the Name with Required, string length and UI hint.Set the metadatatype of the public class to typeof(class) [ScaffoldTable(true)] [MetadataType(typeof(AgencyMetadata))] public partial class Agency { private class AgencyMetadata { [ScaffoldColumn(false)] public object ID { get; set; } [Required(ErrorMessage="The agency name is required")] [StringLength(10,ErrorMessage="This field is limited to 10 characters")] [UIHint("The name of the agency")] public object Name { get; set; } } }7. As a final step import the v2 version with all the hints. Point out the display name on spacefaring countries!*
  • Explain that it is still ASP.NET – This is additiveOverwrite the style sheet with the custom oneOpen the site.master page and change the page title (HTML and body) and add an image to it. Set image height/width to 75Now point out the dynamicdata folder in the solution. Point out the various sub folders and show what is in them. Explain that this isn’t rocket science it’s just dev ;)*
  • In solution Explorer -> Dynamic Data -> Field Templates -> Add new item Dynamic Data Field -> Spinner.ascxShow how it creates the edit version. Delete the non-edit version because we are happy how this displays normally. Remember to mention insert mode items can exist too!Copy code out of spinner front and back and explain what it doesAdd the attribute to the field [DataType("Spinner")]Demo the coolnees*
  • Point out the spacefaring name doesn’t show!Explain the data type is wrong also say what if the DBA makes some changes (say new tables for sex and species and updates the astronauts?). Restore v2 DBOpen the design surface for the data context. Show the fields have not autoupdated. This is good – it’s safeRemove astronaut and space faring and re-add them with sex and specifies. Point out the fact that if we had editted the auto generated code, we would have lost that work. This is why we use the partial class.Run the demo – Show the column for space faring now works!Show the new fields on astronauts! Show how the space suits don’t work. (Spot question why?)Add meta data from file. Show results*
  • Transcript

    • 1. TR: ASP.NET Dynamic Data
      Work smarter, not harder
      ASP.NET++
    • 2. The problem
    • 3. Traditional Solution
    • 4. ASP.NET Dynamic Data Solution
    • 5. What is Scaffolding?
    • 6. How does ASP.NET Dynamic Data do it?
    • 7. Scaffolding Demo
    • 8.
    • 9.
    • 10.
    • 11.
    • 12. A note on security
      Security is not inferred from the DB 
      User doesn’t have enough permissions errors will occur
      Can use custom pages and only provide list views (effectively making them read only)
      Remember: It’s just ASP.NET
      • Can code custom solution
      • 13. Can code support for inferring from the DB
      • 14. Can use ASP.NET credential/role system

    ×