Grasping The LightSwitch Paradigm


Published on

From Visual Studio Live! Redmond presentation "Grasping The LightSwitch Paradigm (The Taming of the Tool)"

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Visual Studio Live! Las Vegas 2011MGB 2003 © 2003 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
  • Grasping The LightSwitch Paradigm

    1. 1. Grasping The LightSwitch Paradigm (The Taming of the Tool) Level: Intermediate October 20, 2011 Andrew Brust CEO and Founder Blue Badge Insights
    2. 2. <ul><li>CEO and Founder, Blue Badge Insights </li></ul><ul><li>Member, Microsoft BI Partner Advisory Council </li></ul><ul><li>Microsoft Regional Director, MVP </li></ul><ul><li>Co-chair VSLive! and over 16 years as a speaker </li></ul><ul><li>Founder, Microsoft BI User Group of NYC </li></ul><ul><ul><li>http:// </li></ul></ul><ul><li>Co-moderator, NYC .NET Developers Group </li></ul><ul><ul><li> </li></ul></ul><ul><li>“ Redmond Review” columnist for Visual Studio Magazine and Redmond Developer News </li></ul><ul><li>, Twitter: @andrewbrust </li></ul>Meet Andrew
    3. 3. The LightSwitch White Papers <ul><li>Go to and click on white paper links </li></ul><ul><li>Or use these direct, shortened URLs: </li></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><ul><li> </li></ul></ul><ul><li>Get these slides on SlideShare </li></ul>
    4. 4. Agenda <ul><li>Intro </li></ul><ul><li>Basic Skills </li></ul><ul><li>Advanced Techniques </li></ul>
    5. 5. INTRO
    6. 6. What is LightSwitch? <ul><li>A streamlined, optimized system for building line of business applications </li></ul><ul><li>A SKU of Visual Studio – introduces new C#/VB project types </li></ul><ul><li>Built on the existing MS stack </li></ul><ul><ul><li>Uses Silverlight on the front-end, leverages IIS </li></ul></ul><ul><ul><li>Uses Entity Framework, RIA Services and other core .NET components too </li></ul></ul><ul><ul><li>Uses SQL Server if maintaining its own database </li></ul></ul><ul><ul><ul><li>Can also connect to existing SQL Server and other databases </li></ul></ul></ul><ul><ul><li>Can Read/Write SharePoint 2010 Lists </li></ul></ul>
    7. 7. Core Concepts <ul><li>Data Sources </li></ul><ul><ul><li>Entities/Tables and Properties/Columns </li></ul></ul><ul><li>Screens </li></ul><ul><ul><li>Template-based, but full control over design </li></ul></ul><ul><ul><li>Groups and controls; lots of nesting </li></ul></ul><ul><li>Access Control </li></ul><ul><ul><li>Built-in role-based security </li></ul></ul><ul><li>Code </li></ul><ul><ul><li>Computed data properties </li></ul></ul><ul><ul><li>Full event model </li></ul></ul><ul><li>Extensions </li></ul><ul><ul><li>Controls and more </li></ul></ul>
    8. 8. What’s Different? <ul><li>Model-driven </li></ul><ul><li>No forms package. Instead, you design screens schematically. </li></ul><ul><ul><li>Generic structures with specific implementations </li></ul></ul><ul><li>Business Types, not just data types </li></ul><ul><li>Built-in export to Excel </li></ul><ul><li>No requirement to code…and yet plenty of opportunity to do so </li></ul>
    9. 9. What Else is Different? <ul><li>Many things are inferred: </li></ul><ul><ul><li>Screen scenarios </li></ul></ul><ul><ul><li>Screen region layout </li></ul></ul><ul><ul><li>Control types, and read-only equivalents </li></ul></ul><ul><ul><li>Invoking your default detail screen when Summary Property clicked </li></ul></ul><ul><ul><li>Impact of access control on UI </li></ul></ul><ul><ul><li>The context-sensitive role of buttons (Command Bars) </li></ul></ul><ul><li>Very cloud-capable </li></ul><ul><ul><li>Works with Windows Azure and/or SQL Azure </li></ul></ul><ul><ul><li>Might have the best deployment story in the stack </li></ul></ul>
    10. 10. BASIC SKILLS
    11. 11. The IDE: Data Toolbar Can have multiple data sources Our entity, in the singular Our entity set, pluralized Entity type becomes field type Properties window
    12. 12. Business Types <ul><li>Imply UI, formatting, data validation </li></ul><ul><li>Built-In: </li></ul><ul><ul><li>Phone </li></ul></ul><ul><ul><li>Email </li></ul></ul><ul><ul><li>Money </li></ul></ul><ul><li>Others can be added through extensions </li></ul><ul><li>Business Types can be very useful when connecting to an existing database </li></ul><ul><ul><li>Just change underlying data type to business type in the data designer </li></ul></ul>
    13. 13. The IDE: Screens Members area Query and its properties. Can drag properties onto visual tree Methods (editable) Toolbar Layout Group Controls. Icons represent control types. Click drop-down arrow to change. Add more elements Screen Name (editable) Command bars
    14. 14. Screen Templates <ul><li>Details </li></ul><ul><li>Editable Grid </li></ul><ul><li>List and Details </li></ul><ul><li>New Data </li></ul><ul><li>Search Data </li></ul>
    15. 15. Adding an Entity And Building a Screen
    16. 16. What You Get For Free Ribbon Menu Tabbed layout Toolbar Search box Data Navigation Design while executing! Data Validation UI
    17. 17. Design Mode Commit or roll back the changes and you’re done! This is an actual live copy of your app. You can even do data entry and click controls Visual tree and Properties window for you to make live changes interactively
    18. 18. Navigation <ul><li>The side bar menu is generated and updated automatically, as you add screens </li></ul><ul><li>You can customize it though: </li></ul><ul><ul><li>Change order of items </li></ul></ul><ul><ul><li>Add, remove or rename screens and groups </li></ul></ul><ul><ul><li>Show/hide screens programmatically </li></ul></ul><ul><ul><ul><li>Using the CanRun event </li></ul></ul></ul>
    19. 19. Pop-ups <ul><li>Screens for creating and editing individual records are generated on-the-fly by LightSwitch </li></ul><ul><li>See them by clicking the Edit or Add New buttons on the toolbar </li></ul><ul><li>You can replace these generated screens with your own… </li></ul>
    20. 20. Parameterization and Loading Screens Through Code <ul><li>You can design your own screens for creating or editing single records & use them in place of the generated pop-up screens </li></ul><ul><ul><li>Use New Data and Details screen templates </li></ul></ul><ul><li>For New Data screen: </li></ul><ul><ul><li>You must put code in Add button’s Execute event handler: </li></ul></ul><ul><ul><ul><li>this.Application.Show ScreenName (); </li></ul></ul></ul><ul><li>For Details screen: </li></ul><ul><ul><li>Set the “Use as Default Details Screen” option in the Add New Screen dialog box. </li></ul></ul>
    21. 21. Navigation, Popups Buttons, Loading Screens
    22. 22. Data Validation <ul><li>You can easily add your own Validation in code. </li></ul><ul><ul><li>Click Custom Validation in the Properties window, </li></ul></ul><ul><ul><li>Put in conditional logic and pass a string to the results.AddPropertyError method. </li></ul></ul><ul><li>Use AddEntityError method for server-side validation when saving changes </li></ul><ul><li>Or AddPropertyResult and AddEntityResult for info and warning messages </li></ul><ul><li>Validation goes in data model, and flows into all screens. Even generated ones. </li></ul>
    23. 23. The Event Model <ul><li>Types: General, Access Control </li></ul><ul><li>Objects: </li></ul><ul><ul><li>Queries </li></ul></ul><ul><ul><li>Data Sources </li></ul></ul><ul><ul><li>Tables </li></ul></ul><ul><ul><li>Properties (Fields), for validation </li></ul></ul><ul><ul><li>Computed fields, for computation </li></ul></ul><ul><ul><li>Screens </li></ul></ul><ul><ul><li>Buttons ( Execute and CanExecute ) </li></ul></ul><ul><ul><li>Menu items ( CanRun event hook) </li></ul></ul>
    24. 24. Data Validation
    25. 25. Buttons and Command Bars <ul><li>Have Execute and CanExecute events </li></ul><ul><li>Buttons are children of Command Bars and Command Bars are everywhere </li></ul><ul><ul><li>Ribbon, toolbar, collection controls, rows within collection controls </li></ul></ul><ul><ul><li>Simple controls too…just right click and then select Add Button… </li></ul></ul><ul><li>So buttons can go just about anywhere </li></ul><ul><li>Lots of predefined buttons: </li></ul><ul><ul><li>AddNew, AddAndEditNew, EditSelected, DeleteSelected, RemoveSelected, Refresh </li></ul></ul>
    26. 26. Ribbon Buttons
    28. 28. Queries <ul><li>All screens’ data are fetched through queries </li></ul><ul><li>You can edit these and add: </li></ul><ul><ul><li>Filter </li></ul></ul><ul><ul><li>Sort </li></ul></ul><ul><ul><li>Parameter </li></ul></ul><ul><ul><li>Group </li></ul></ul><ul><li>Also </li></ul><ul><ul><li>Support paging, sorting, search </li></ul></ul><ul><ul><li>Set page size </li></ul></ul>
    29. 29. Layout <ul><li>Screen layout is based on layout groups: </li></ul><ul><ul><li>Rows, Columns, Table, Tabs, Modal Window </li></ul></ul><ul><li>These are nest-able </li></ul><ul><li>Scroll bars, splitter bars and relative sizing of screen region controllable through: </li></ul><ul><ul><li>Scroll Enabled, Alignment, Min/Max Height/Width, Is Row/Column Resizable properties provide </li></ul></ul>
    30. 30. Queries and Layout
    31. 31. Search <ul><li>Built in to List and Data Grid controls </li></ul><ul><li>Implemented automatically on all string fields </li></ul><ul><li>Can be disabled at the property or entity level using Is Searchable property </li></ul><ul><ul><li>Support search property on screen query </li></ul></ul><ul><li>Search-ability defined in the data model; respected by all screens </li></ul><ul><ul><li>Even the generated ones </li></ul></ul><ul><li>Search is rather brute force </li></ul><ul><ul><li>So don’t allow too many fields to be searchable </li></ul></ul>
    32. 32. Access Control <ul><li>Optional Windows- or forms-based authentication </li></ul><ul><li>You define: </li></ul><ul><ul><li>Groups, and their membership </li></ul></ul><ul><ul><li>Named permissions, which you check programmatically in code </li></ul></ul><ul><li>Access control event hooks available for: </li></ul><ul><ul><li>Whether visible: </li></ul></ul><ul><ul><ul><li>Screens in the navigation menu </li></ul></ul></ul><ul><ul><ul><li>Buttons </li></ul></ul></ul><ul><ul><li>Whether editable: </li></ul></ul><ul><ul><ul><li>Properties/fields, </li></ul></ul></ul>
    33. 33. Access Control
    34. 34. Extensions <ul><li>Controls </li></ul><ul><li>Screen Templates </li></ul><ul><li>Custom Data Sources </li></ul><ul><li>Business Types </li></ul><ul><li>Themes </li></ul><ul><li>Shells </li></ul>
    35. 35. Themes and Shells
    36. 36. Extensions
    37. 37. Deployment <ul><li>Client is in-browser or desktop </li></ul><ul><li>Middle tier on PC, server or Azure </li></ul><ul><li>Deploy your database, or use existing db </li></ul><ul><li>Work in SQL Server user instance mode + Express during dev, but deploy to SQL Server or SQL Azure. </li></ul><ul><ul><li>Or stay in Express! </li></ul></ul>
    38. 38. Platform Shifts and Market Analysis <ul><li>Most LOB app tools give high productivity but low customization. LS is different. </li></ul><ul><li>Most are either frameworks or code generators. LS is different. </li></ul><ul><li>LS is model-driven. It renders Silverlight code/XAML today. What about tomorrow? </li></ul>
    39. 39. Thank you <ul><li>[email_address] </li></ul><ul><li>@andrewbrust on twitter </li></ul><ul><li>Want to get the free “Redmond Roundup Plus?” </li></ul><ul><ul><li>Text “bluebadge” to 22828 </li></ul></ul>