extending lightswitch applications

27
Boulos Dib April 19, 2012 NYC .Net User Group

Upload: boulos-dib

Post on 29-Nov-2014

3.034 views

Category:

Education


0 download

DESCRIPTION

Presentation given to New York City .Net Developers on April 19, 2012. http://www.nycdotnetdev.com/EventDetail.aspx?f=list&event=4/19/2012

TRANSCRIPT

Page 1: Extending Lightswitch Applications

Boulos Dib

April 19, 2012

NYC .Net User Group

Page 2: Extending Lightswitch Applications

Boulos Dib - @boulosdib

Independent Consultant – Napeague Inc. Software Developer since 1983 First Commercial Personal Computer 1980 – TRS-80 III First Z80 based product (EPROM based Protocol Adaptor – 1984) First Commercial PC-DOS product (Telex on IBM PC, 50 Baud – 1985) Started 16-bit Windows Development using Win 3.x Used: 8080/Z80, 68xxx, PDP/RSX,VAX-VMS and x86 (C/C++/C#) Develop in: ASP.Net, SilverLight, Adobe Flex, SharePoint, SQL Server,

PowerShell, Exchange, Active Directory, Javascript, HTML, CSS and… Co-organizer of NYC XAML Meetup and New York Windows Phone User

Group. Speaker and Volunteer at local user groups . I also have a life not touched by Computers:

Favorite sport – Windsurfing Favorite hobby – Guitar Playing, Electric & Acoustic.

Page 3: Extending Lightswitch Applications

Agenda Introduction to Visual Studio LightSwitch.

Create Simple Out-of-the-box LightSwitch Application

Survey Extensibility Model and Options

Demos

Consume Silverlight Custom Control

Consume LightSwitch Custom Control

Consume LightSwitch Extension

Create a LightSwitch Extension(s)

Wrap-up

Page 4: Extending Lightswitch Applications

Assumptions Familiarity with .Net Development.

You can develop a simple application in C# (or VB.Net) using Visual Studio (Demo with C#).

Have some understanding of Silverlight.

Page 5: Extending Lightswitch Applications

What is Visual Studio LightSwitch Simplest Development Environment for creating Line

Of Business Applications (LOB).

Yeah, we heard that before, didn’t we?

Microsoft Access, VB, C# etc…

Page 6: Extending Lightswitch Applications

Line of Business Applications Wikipedia says:

"line-of-business application" is one of the set of critical computer applications perceived as vital to running an enterprise.

I say:

Line of Business application is one of the set of unique, custom and potentially critical computer applications perceived as vital to running an enterprise.

Page 7: Extending Lightswitch Applications

Are all LOB applications built by developers? Based on my experience: NOT!!! Introducing: Citizen Developers

Gartner Says *

Citizen Developers Will Build at Least 25 Percent of New Business

Applications by 2014

http://www.gartner.com/it/page.jsp?id=1744514

Page 8: Extending Lightswitch Applications

What is Visual Studio LightSwitch Simplest Development Environment for creating Line

Of Business Applications .

Able to consume data from Databases, SharePoint, Clouds, WCF RIA Services and OData (VS-11 Beta).

Can run as a web or desktop application

LightSwitch Web Applications can be deployed on local or remote IIS, as well as in Windows Azure WebRole.

Page 9: Extending Lightswitch Applications

2 Types of LightSwitch Developers Development IN LightSwitch - Superset of Citizen Devs

Uses Visual Studio LightSwitch 2010

Write Data Driven LightSwitch Applications

Uses Silverlight and LightSwitch Controls Written by Microsoft, 3rd Party Vendors and the community.

Development FOR LightSwitch- Professional Developers Visual Studio Professional 2010 or greater

Visual Studio LightSwitch 2010

Write Silverlight Custom Controls

Write LightSwitch Controls and Extensions

Page 10: Extending Lightswitch Applications

Why LightSwitch? Simple(r) development tool.

Silverlight/Windows based infrastructure

Advanced development skills not required to build simple data-driven applications.

Easy deployment to IIS and Azure

Connectivity to SharePoint

Consumer of SQL Server and Other Databases

Consumer of almost any data source via custom WCF RIA Services (and with VS2011, OData)

Page 11: Extending Lightswitch Applications

LightSwitch Development

Start

Describe your data

Create screens for common tasks

Refine

Author business logic

Customize screen layouts

Define custom queries

Extend

Explore ecosystem

Create Custom Silverlight Controls

Integrate With Custom Data Sources

Page 12: Extending Lightswitch Applications

LightSwitch Architecture

Methods Controls Screens

Data Workspace

Submit Pipeline Queries

Data Workspace

Data Access Middle Tier Client Tier

Page 13: Extending Lightswitch Applications

LightSwitch Building Blocks LightSwitch VS Pro Ecosystem

Page 14: Extending Lightswitch Applications

Application Structure Folder Use

Client Screens and Client Code

Common Code Common to Client and Server

Data Data Model

Server Server specific code

Page 15: Extending Lightswitch Applications

Demo – Simple LightSwitch Application

Data and Screens

Screens are automatically generated based on entities.

Queries for both Entities and Screens

Business Logic

Demo

Simple LightSwitch Application

Page 16: Extending Lightswitch Applications

Beyond Simple LightSwitch Development

Even with LightSwitch, developers can access LightSwitch APIs, Silverlight and the .Net Framework

Including

Custom Screen Layouts

Save Pipeline, Validation & Access Control Hooks

Customize Complex and Composite LINQ Queries (i.e. EntityName_All EntityName_Single)

Client and Server Project Code

COM Interop

Publish to IIS or Windows Azure

Page 17: Extending Lightswitch Applications

Extending LightSwitch Utilize .Net Assemblies

Incorporate Silverlight Controls

Add LightSwitch Extensions

Amazing Third Party Extensions

Great Open Source and Community Driven Extensions

Roll Your Sleeves and Build your own

Page 18: Extending Lightswitch Applications

Requirements for Building Extensions

Visual Studio Pro or Ultimate + SP1 http://www.microsoft.com/visualstudio/en-

us/products/2010-editions

Visual Studio LightSwitch http://www.microsoft.com/visualstudio/en-us/lightswitch

Visual Studio 2010 SP1 SDK (Needed to build VSIX packages) http://www.microsoft.com/download/en/details.aspx?id=218

35

LightSwitch Extensibility Toolkit http://visualstudiogallery.msdn.microsoft.com/0dfaa2eb-

3951-49e7-ade7-b9343761e1d2

Page 19: Extending Lightswitch Applications

Extensions - Ecosystem You do not need to build extensions, there are many

available and the list is growing. Vendors

ComponentOne - OLAP for LightSwitch DevExpress – DXEditors & XtraReports for LightSwitch FirstFloor – Document Toolkit for LightSwitch Infragistics – NetAdvantage for Visual Studio LightSwitch Telerik – Rad Controls for Silverlight RSSBus – Data Providers for: Google, PowerShell, Facebook,

Quickbooks, Salesforce, Sharepoint, Twitter

Community Driven Look in the Gallery….

Page 20: Extending Lightswitch Applications

LightSwitch Extension Types Silverlight Controls

Screen Templates

Business Types

Themes

Shell

Custom Data Sources

Page 21: Extending Lightswitch Applications

Extension Projects Project Purpose

Client Contains client implementations that should be deployed with a LightSwitch application but are not found in the Common project. For example, controls, shells, and themes.

Client.Design Contains implementations necessary during the debugging of a LightSwitch application. For example, control images or custom property editors for the runtime screen designer.

Common Contains implementations that are common to both the client and the server. For example, metadata loaders and validators.

Design Contains implementations for design time integrated development environment (IDE) operations. For example, a screen template.

Server Contains server implementations that should be deployed with a LightSwitch application but are not found in the Common project. For example, data sources.

Project Purpose

.Lspkg .Lspkg packages the above five projects so that LightSwitch can unpack and reference them when the package is installed

.Vsix .Vsix project packages the generated .Lspkg file into a .Vsix package so that it can be added to LightSwitch through the Extension Manager

Page 22: Extending Lightswitch Applications

Using Extensions Installing Extensions

Manually double-clicking a VSIX package.

Extension Manager Within Visual Studio Pro ++

Visual Studio RESTART almost always required.

For Shell and Theme Extensions:

Activate Extension by Opening Project Properties and check the Extensions tab.

To Apply a theme or a shell, Open the same Project Properties and theme or shell in the General properties.

Page 23: Extending Lightswitch Applications

Creating a Theme Extension We will create a theme

Modify few resources

Test it against a simple application

Page 24: Extending Lightswitch Applications

Using Silverlight Custom Controls Easier to use than writing

Do not know anything about LightSwitch

There 2 possibilites Build a control for a specific entity (VM) and bind it to a

specific entity - less code but not re-usable. Can not be used for any other entity or data.

Build a control and bind the code in the LightSwitch code – More LightSwitch code but Silverlight Control can be re-used across screens and applications.

Demo – based on Code Magazine article by LightSwitch team member Karol Zadora-Przylecki

Page 25: Extending Lightswitch Applications

References - Sites Beth Massi

http://blogs.msdn.com/b/bethmassi/

Andrew Brust – Microsoft LightSwitch White Papers http://bit.ly/pjD6Ke

LightSwitch Community Site – Michael Washington http://lightswitchhelpwebsite.com/

Jan Van Der Haegen http://janvanderhaegen.wordpress.com/extensionsmadeeasy/

Code Magazine July/August 2011 Using Custom Controls to Enhance LightSwitch Application UI by

Karol Zadora-Przylecki

Visual Studio Gallery http://visualstudiogallery.msdn.microsoft.com/site/search

Page 26: Extending Lightswitch Applications

Books

Beginning Microsoft Visual Studio LightSwitch Development Istvan Novak

Microsoft Visual Studio LightSwitch Unleashed Alessandro Del Sole

Pro Visual Studio LightSwitch 2011 Development Yann Duran, Tim Leung

Page 27: Extending Lightswitch Applications

Thank You and Follow-up Contact:

http://blog.boulosdib.com

@boulosdib