ptg7947203
ptg7947203
Microsoft
®
Visual Studio
®
LightSwitch
®
UNLEASHED
800 East 96th Street, Indianapolis, Indiana 46240 USA
Alessandro Del Sole
ptg7947203
Microsoft® Visual Studio® LightSwitch® Unleashed
Copyright © 2012 by Pearson Education, Inc.
All rights reserved. No part of this book shall be reproduced, stored in a retrieval
system, or transmitted by any means, electronic, mechanical, photocopying, recording,
or otherwise, without written permission from the publisher. No patent liability is
assumed with respect to the use of the information contained herein. Although every
precaution has been taken in the preparation of this book, the publisher and author
assume no responsibility for errors or omissions. Nor is any liability assumed for
damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33553-2
ISBN-10: 0-672-33553-0
Library of Congress Cataloging-in-Publication Data:
Del Sole, Alessandro.
Microsoft Visual studio LightSwitch unleashed / Alessandro Del Sole.
p. cm.
Includes bibliographical references.
ISBN 978-0-672-33553-2
1. Microsoft Visual studio LightSwitch. 2. Visual programming (Computer science)—
Computer programs. 3. Application software—Development—Computer programs.
I. Title.
QA76.65.D45 2012
005.7'26—dc23
2012002305
Printed in the United States of America
First Printing: February 2012
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks
have been appropriately capitalized. Pearson Education, Inc. cannot attest to the accu-
racy of this information. Use of a term in this book should not be regarded as affecting
the validity of any trademark or service mark.
Microsoft, Visual Studio, and LightSwitch are registered trademarks of Microsoft
Corporation.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possi-
ble, but no warranty or fitness is implied. The information provided is on an “as is”
basis. The author and the publisher shall have neither liability nor responsibility to any
person or entity with respect to any loss or damages arising from the information
contained in this book.
Bulk Sales
Pearson offers excellent discounts on this book when ordered in quantity for bulk
purchases or special sales. For more information, please contact:
U.S. Corporate and Government Sales
1-800-382-3419
corpsales@pearsontechgroup.com
For sales outside of the U.S., please contact:
International Sales
+1-317-581-3793
Editor-in-Chief
Greg Wiegand
Executive Editor
Neil Rowe
Development Editor
Mark Renfrow
Managing Editor
Sandra Schroeder
Senior Project Editor
Tonya S imp s on
Copy Editor
Keith Cline
Indexer
Brad Herriman
Proofreader
Sarah Kearns
Technical Editor
Beth Massi
Publishing
Coordinator
Cindy Teeters
Book Designer
Gary Adair
Compositor
Mark Shirar
ptg7947203
Contents at a Glance
Part I Building Applications with LightSwitch
1 Introducing Visual Studio LightSwitch ................................................1
2 Exploring the IDE ..........................................................................23
3 Building Data-Centric Applications ...................................................43
4 Building More-Complex Applications
with Relationships and Details Screens ..............................................95
Part II Manipulating Data
5 Customizing Data Validation..........................................................149
6 Querying, Filtering, and Sorting Data...............................................177
7 Customizing Applications with Buttons,
COM Automation, and Extensions ..................................................215
8 Aggregating Data from Different Data Sources ...................................235
Part III Securing and Deploying Applications
9 Implementing Authentication and Authorization ..............................291
10 Deploying LightSwitch Applications ................................................339
Part IV Advanced LightSwitch
11 Handling Events in Code ...............................................................409
12 Dissecting a LightSwitch Application ...............................................443
13 Advanced LightSwitch with Visual Studio 2010 .................................479
14 Debugging LightSwitch Applications ...............................................517
Part V Extensibility
15 Customizing the IDE.....................................................................543
16 Customizing Applications with Custom Controls...............................561
17 Implementing Printing and Reporting .............................................581
18 LightSwitch Extensibility: Themes, Shells, Controls, and Screens ..........619
19 LightSwitch Extensibility: Data and Extension Deployment.................693
Appendixes
A Installing and Configuring Visual Studio LightSwitch .........................759
B Useful Resources...........................................................................765
Index .........................................................................................771
ptg7947203
Table of Contents
Part I Building Applications with LightSwitch
1 Introducing Visual Studio LightSwitch 1
Who Uses LightSwitch? ....................................................................3
A Short History of Microsoft Business Tools..........................................3
Microsoft Access with Visual Basic for Applications........................4
Microsoft Visual Basic 6 ............................................................6
Microsoft Visual FoxPro ............................................................9
Microsoft Visual Studio .NET (2002 to 2010) ...............................10
About Visual Studio LightSwitch.......................................................13
Technologies Used Behind the Scenes ........................................15
Available Editions...................................................................18
Companion Source Code .........................................................18
Setting Up the Development Machine ...............................................19
Operating System ...................................................................19
Development Environment......................................................19
Server Components ................................................................19
Database Tools .......................................................................20
Controls and Toolkits..............................................................21
What You Need to Know About Programming ....................................21
Summary......................................................................................22
2 Exploring the IDE 23
Getting Started with Visual Studio LightSwitch ...................................23
Introducing the Start Page .......................................................25
Creating New Projects and Exploring Solutions ...........................26
The LightSwitch Designer ........................................................29
The Entity Designer ................................................................30
The Screen Designer ...............................................................30
The Properties Window ...........................................................32
The Query Designer ................................................................33
The Application Designer ........................................................34
The Code Editor .....................................................................35
Building, Running, and Debugging Applications..........................35
Managing and Arranging Windows ...........................................37
Getting Help .................................................................................38
Visual Studio 2010 with LightSwitch .................................................39
Summary......................................................................................41
Microsoft Visual Studio LightSwitch Unleashed
iv