Contents
Chapter 1: Introducing LightSwitch
Understanding LightSwitch’s Architecture
Introducing the Model-Centric Architecture
Understanding the Model-View-ViewModel Pattern
Examining LightSwitch Projects
Chapter 2: Setting Up Your Data
Choosing Where to Store Your Data
What Are Entities and Properties?
Storing Numbers (Double and Decimal Types)
Using LightSwitch Business Types
Storing Web Addresses and Percentage Values
Examining What Happens in SQL Server
Choice Lists vs. Related Tables
Defining One-to-Many Type Relationships
How Relationships Are Defined in SQL Server
Defining Self-Referencing Relationships
Defining Many-to-Many Relationships
Determining How Child Records Are Deleted
Attaching to an Existing Database
Calculating Dates with Computed Properties
Summarizing Child Records with Computed Properties
Returning Images with Computed Properties
Sorting and Filtering by Computed Properties
Chapter 3: Introducing Silverlight Screen Design
Introducing the Screen Designer Toolbar
Grouping and Laying Out Your Screen
Displaying Static Text and Images
Displaying Data Using Data Item Containers
Showing Collections of Records
Configuring Data Grid Settings
Setting Data Grid Header Buttons
Using the Auto Complete Box Control
Using the Modal Window Picker Control
Styling Labels and Static Text Controls
Setting Application Properties
Changing the Language and Culture Settings
Chapter 4: Accessing Data with Code
Performing Application Tasks in Code
Finding Single Records by ID Value
Working with Properties and Nullable Data Types
Working with the Save Pipeline
Calling Server-Side Code from the Client
Discarding Items That Have Changed
Managing Transactions in LightSwitch
Applying Transactions on Screens
Creating Transactions in the Save Pipeline
Displaying a Data-Conflict Screen
Understanding Validation in LightSwitch
How MVVM Applies to Validation
Identifying Where Validation Runs
Creating Validation Rules and Warnings
Comparing Against Other Properties
Mandating Data Using Conditions
Validating Patterns with Regular Expressions
Checking Against Child Collections
Enforcing Uniqueness and Preventing Duplicates
Validating Deletions on the Server
Accessing Validation Results in Code
Introduction to Data Retrieval
LightSwitch Queries Always Return Entities
Understanding the Query Pipeline
Using LightSwitch’s Default Queries
Creating Queries Based on Entities
Comparing Against Other Fields/Properties
Passing Arguments into a Query
Understanding Method (Lambda) Syntax Code
Using Standard Query Operators
Filtering Data with Lambda Expressions
Using the Any and All Operators
Filtering by Related Child Items
Adding Your Global Value to Your LSML File
Creating the Global Value Class
Using Global Values in Upgraded Projects
Chapter 7: Mastering Silverlight Screen Design
Displaying Custom Text and Information
Adding Data Controls to a Screen
Setting Control Values and Default Values
Setting the Screen Title in Code
Creating an Advanced Search Screen
Opening Screens from Buttons or Links
Passing Arguments into Screens
Creating a Continuous New Data Screen
Finding Controls Using FindControl
Reference the Underlying Silverlight Control
Handling Silverlight Control Events
Bulk Updating Records by Using a Multiselect Grid
Assigning and Unassigning Self-Joined Data
Creating Screens to Work with Single Row Tables
Finding Out Which Thread Your Code Is Executing On
Understanding When to Execute Code on a Different Thread
Using PropertyChanged on a New Data Screen Template
Using PropertyChanged on a Details Screen
Opening Files in Their Application
Chapter 8: Creating HTML Interfaces
Setting Up Visual Studio for HTML Development
Adding Screens to Your Application
Understanding the Top-Level Screen Layout
Creating a Navigation Structure
Navigating to Different Screens
Creating Child Records in a Dialog
Editing Child Records in a Dialog
Extending Your Application with JavaScript
Using the LightSwitch JavaScript API
Accessing Screen Data Collections
Showing Data with Custom Controls
Running Code When Data Changes
Replacing Default Controls with Custom Controls
Customizing the Appearance of Your Application
Changing the Application Icon and Title
Chapter 9: Creating and Using RIA Services
Creating an RIA Services Project
Creating a Domain Service Class
Retrieving a Connection String from web.config
Chapter 10: Sharing Data with OData
Finding Third-Party Data Sources to Use
Determining Connection Settings
Connecting to an OData Data Source
Understanding Default Data Source Options
Exposing Your LightSwitch Data via OData
Finding Your Application’s End Point URL
Connecting to LightSwitch Data from Excel
Connecting to LightSwitch Data from .NET
Connecting to Use LightSwitch from Other Platforms
Chapter 11: Creating and Using Custom Controls
Binding Data to Custom Controls
Binding Data Collections to Custom Controls
Converting Values When Data Binding
Creating a Custom Silverlight Control
Understanding Dependency Properties
Creating a New Control and Dependency Property
Binding Dependency Properties to the Data Context
Applying the Duration Control on a Screen
Calling Custom Control Methods via Dependency Properties
Calling Screen Code from a Custom Control
Chapter 12: Creating Control Extensions
Installing LightSwitch Extensions
Using the Many-to-Many Data Control
Preparing Your Computer to Develop Extensions
Understanding Custom Control Types
Specifying Which Data Types to Support
Supporting the FindControl Method
Running and Deploying Your Extension
Setting Product/Installation Attributes
Creating a Detail Control (ComboBox)
Setting the Control’s Metadata
Finding the Summary Property for an Entity
Creating Custom Property Editors
Customizing Visual Studio’s Property Editor
Customizing the Runtime Designer
Creating a Group Control Extension
Setting the Visibility of Labels
Creating a Command Control Extension
Chapter 13: Creating Data and Presentation Extensions
Creating a Business Type Extension
Associating Custom Controls with Business Types
Creating Custom Property Editor Windows
Creating a Custom Shell Extension
Defining the Look of Your Shell
Displaying Your Application’s Logo
Adding Code That Supports our Custom Shell
Setting the Name and Description
Creating a Custom Theme Extension
Creating a Screen Template Extension
Creating More Complex Screen Templates
Creating a Data Source Extension
Creating the Data Service Class
Using the Data Source Extension
Using ASP.NET to Create Reports
Deploying Your ASP.NET Application
Using Microsoft SQL Server Reporting Services
Linking Reports to LightSwitch
Opening Reports in a New Browser Window
Displaying Reports Inside a LightSwitch Screen
Opening Reports in an HTML Client Application
Creating Reports with Microsoft Word
Performing Mail Merges with Word
Using Other Third-Party Solutions
Sending E-mail by Using Server-Side Code
Sending E-mail When Data Changes
Making Your E-mail Code Reusable
Using Configuration Settings to Save Credentials
Triggering Server E-mail from an Onscreen Button on the Client
Sending E-mails with File Attachments
Creating Mail in a Pickup Folder
Sending Mail via Outlook by Using COM Automation
Opening the Default Mail Program
Using mailto in a Silverlight Client
Using mailto in the HTML Client
Calling External Resources from LightSwitch Clients
Using AJAX from the HTML Client
Calling Web Services from the Silverlight Client
Chapter 16: Authenticating Your Users
Choosing an Authentication Method
Enabling Windows Authentication
Understanding Where User Details Are Stored
Changing the Password Complexity Rules
Changing Password-Encryption Settings
Sharing Forms Authentication Data with ASP.NET
Allowing Users to Log Out of Web Applications
Chapter 17: Authorizing Your Users
Setting Up Administrators Who Can Manage Users
Applying Table-Level Access Control
Applying Screen-Level Access Control
Applying Query-Level Permissions
Specifying the Application Administrator
Associating Logins with Your Data
Opening Screens Conditionally at Login
Restricting Row-Level Access to Data
Setting Screen Control Properties by Permission
Allowing Users to Bypass Validation
Chapter 18: Deploying Your Application
Getting Started with Deployment
Choosing an Application Topology
Choosing Whether to Publish or Package
Digital Signature/Certificate Page
Setting Up IIS on Windows Server 2008/2012
Setting Up IIS on Windows 8, 7, or Vista
Setting Up IIS 6 on Windows 2003
Setting Up IIS Application Pools
Configuring SQL Server Windows Authentication
Configuring Secure Sockets Layer (SSL)
Installing the LightSwitch Server Components
Installing a Two-Tier Desktop Application
Installing a Three-Tier Browser and Desktop Applications
Troubleshooting Deployment Errors
Connecting Visual Studio to Azure
Choosing an Azure Service Type
Completing the Publishing Process
Appendix B: Data Type Identifiers
Appendix C: Using Properties in Custom Controls