Visual Studio LightSwitch Feature Matrix

On his blog yesterday, Soma (Sr. VP of Developer Division at Microsoft), announced that Visual Studio LightSwitch Beta 2 will be coming soon. I can tell you, we are really excited about LightSwitch, and apparently you are too (you’ve downloaded over 100,000 copies of Beta 1).

One question that comes up a lot is, what can LightSwitch do versus what can Visual Studio Professional do? What’s the difference? Well, the difference is pretty clear.

Visual Studio LightSwitch is a specialist tool for building line-of-business applications for the desktop and cloud, while Visual Studio Professional is a generalist tool for building anything you can imaging for Microsoft platforms.

Take a look at this feature matrix and you’ll see what I mean (we’ll get a formal version of this up on http://www.microsoft.com/lightswitch soon).

Visual Studio LightSwitch

Visual Studio Professional

LightSwitch Runtime

Yes

Yes1

Visual Studio Project System

Yes

Yes

IntelliSense

Yes

Yes

Team Explorer (Team Foundation Server integration)

2, 3

Yes3

LIGHTSWITCH APPLICATION DEVELOPMENT

Predefined Screen Templates

Yes

Yes1

Application Skinning and Theming

Yes

Yes1

Data Entity Designer

Yes

Yes1

Business-oriented Data Types (e.g. EmailAddress, PhoneNumber, etc.)

Yes

Yes1

Automatic Data Input Validation

Yes

Yes1

Windows Azure Deployment

Yes

Yes1

SQL Azure Support

Yes

Yes

LANGUAGES, EDITORS & COMPILERS
Visual Basic

Yes

Yes

Visual C#

Yes

Yes

Visual C++

Yes

Visual F#

Yes

HTML/JavaScript

Yes

Silverlight/XAML Editor

Yes

PROJECT TYPES
LightSwitch Application

Yes

Yes1

ASP.NET

Yes

ASP.NET AJAX

Yes

ASP.NET MVC

Yes

Console Application

Yes

Database Projects

Yes

Office Applications & Add-ins

Yes

Setup Projects

Yes

SharePoint Applications & WebParts

Yes

Test Projects

Yes

Visual Studio Add-ins

Yes

Windows Forms

Yes

Windows Phone

Yes

WCF

Yes

WPF

Yes

XNA Games

Yes

1 Only available for LightSwitch applications. Requires Visual Studio LightSwitch and Visual Studio Professional to both be installed.
2 Team Explorer will integrate with LightSwitch but must be installed separately.
3 Requires a Team Foundation Server Client Access License (CAL).

I hope that helps!

D7

Data Storage in Visual Studio LightSwitch

With the recent release of Visual Studio LightSwitch Beta 1 to MSDN Subscribers, I have gotten a few questions. As questions come in, I’ll do my best to answer them here. One of the first questions I got was about how LightSwitch applications manage and store data source connection information – aka connection strings.

 

Question: In a Visual Studio LightSwitch application, where is the connection string to the database being stored?

LightSwitch applications can work with several types of data, including “local” application data, external SQL Server or SQL Azure data (or any other database supported by the .NET Framework), SharePoint data, and other external data exposed through WCF RIA Services. If you choose to get data from an external source, the Attach Data Source Wizard shows you your options.

Choose DataSource

On the other hand, the “local” application data is a reference to a SQL Server Express database that is created if you choose the “Create new table” option as shown here.

AddTable

This application data is defined and stored in a local SQL Server Express database. For example, in the Vision Clinic demo we have used, the first step was to create a new table to store Patient data. in fact, in the demo we are defining an entity model, and creating a Patients (plural) table in the local application database using SQL Server Express. Notice in the following image that in the Solution Explorer there is a Data Sources node containing an ApplicationData node containing a Patients node. Patients is the table that was created in the ApplicationData database.

 

AppData2

The ApplicationData.mdf file is a SQL Server Express file that is created and stored in the $ApplicationRoot\bin\Data directory. When connected to with Server Explorer, you can see that the Patients table is there, along with the ASP.NET membership tables.

ServerExplorer

So where is the connection string to this database stored? In a Web.config file that is created in the $ApplicationRoot\bin\release directory.

<connectionStrings>
  <add name=”_IntrinsicData” connectionString=”
    Data Source=.\SQLEXPRESS;
   AttachDbFilename=’c:\users\seven\documents\
   visual studio 2010\Projects\VisionClinicDemo\
   VisionClinicDemo\Bin\Data\
   ApplicationDatabase.mdf
‘;
    Integrated Security=True;Connect Timeout=30;
    User Instance=True;MultipleActiveResultSets=True” />
</connectionStrings>

When the application is published (Build | Publish menu), the Publish Application Wizard asks if you want to publish the database directly to an existing database, or if you want to generate a script file to install and configure the database

PubWIzard

If you choose to publish to a database, you are then prompted to provide the database information.

PubWizard2

If you choose to create an install script file, you are prompted to describe the database that will be scripted.

PubWizard3

PubWizard4

All in all this is the standard approach to managing database connections in a multi-tiered application. The Web.config in the application tier contains the database connection information. As will all Web.config files, you may encrypt the connection information.

 

But what about the connections to other data sources, like SQL Azure or SharePoint?

A connection string is a connection string is a connection string. They all get stored in a the Web.config file.

<connectionStrings>

<add name=”_IntrinsicData” connectionString=”Data Source=.\SQLEXPRESS;AttachDbFilename=’e:\my documents\visual studio 2010\Projects\VisionClinicDemo\
VisionClinicDemo\Bin\Data\ApplicationDatabase.mdf’;
Integrated Security=True;Connect Timeout=30;User Instance=True;MultipleActiveResultSets=True” />

<add name=”PrescriptionContosoData” connectionString=”Data Source=server01.data.int.mscds.com;Initial Catalog=PrescriptionContoso;User ID=[removed];Password=[removed]” />

</connectionStrings>

Of course, all of the data in a LightSwitch application is represented by entities. The entities are defined in the ApplicationDefinition.lsml file (stored in $ApplicationRoot\Data). This is simply a reference to the data source(s) represented by the entities in the application. Each data source is described in this file, and the entities representing the data objects are described here as well.

<EntityContainerGroupProperty EntityContainer=”VisionClinicDemo:ApplicationData”
Name=”ApplicationData” />
<EntityContainerGroupProperty EntityContainer=”VisionClinicDemo:PrescriptionContosoData”
Name=”PrescriptionContosoData” />
</EntityContainerGroup>

<DataService DataProvider=”EntityFrameworkDataProvider”
EntityContainer=”:PrescriptionContosoData” Name=”PrescriptionContosoDataDataService”>
<DataService.ConnectionProperties>
<ConnectionProperty Name=”DataProviderName” Value=”91510608-8809-4020-8897-fba057e22d54″ />
<ConnectionProperty Name=”DataSourceName” Value=”067ea0d9-ba62-43f7-9106-34930c60c528″ />
<ConnectionProperty Name=”ProviderInvariantName” Value=”System.Data.SqlClient” />
<ConnectionProperty Name=”SafeConnectionString” Value=”Data Source=server01.data.int.mscds.com;Initial Catalog=PrescriptionContoso;User ID=admin01@server01″ />
<ConnectionProperty Name=”ConnectionStringGuid” Value=”1e9905dc-b519-4003-9387-1272a768b256″ />
<ConnectionProperty Name=”ProviderManifestToken” Value=”2008″ />
</DataService.ConnectionProperties>

</DataService>

 

Summary

All in all, LightSwitch applications are built using standard best practices. In the case of connection strings, they are stored in Web.config files in the application tier, and have all the support of ASP.NET configuration files, including encryption.

D7

Myth Busting Visual Studio LightSwitch

Earlier this week, at the VSLive conference in Redmond, WA (on the Microsoft campus) Jason Zander announced a new Visual Studio product that we’ve been working on – Visual Studio LightSwitch – the simplest way to build business applications for the desktop and cloud.

This is exciting for us – we’ve been working on this product in secret for some time now. Finally we are able to share this work with the world.

Of course, as can often happen, the announcement was followed up with some confusion. Since we aren’t releasing the Beta 1 bits until August 23, 2010, no one (other than the 700 people at VSLive using the hands-on-labs) can actually see LightSwitch in action and get a feel for it. As a result, there is some confusion around what LightSwitch is, what it does, and who should use it. So let me try and dispel a few myths.

Who is LightSwitch for? Who should use it?

LightSwitch is intended for anyone who needs to quickly and affordably create line-of-business applications. LightSwitch is also an ideal tool for professional developers who need to build great-looking custom applications and want to kick start the development with a business application based on the LightSwitch templates.

How is LightSwitch different than Microsoft Access?

Access provides the tools to build and maintain database applications. LightSwitch provides the tools and templates to develop line-of-business applications that can pull data from Access, SQL Server, SQL Azure, SharePoint and any data provided by a WCF RIA Service (Access is not a supported data source in Beta 1). LightSwitch applications can run on the desktop, a web server or in the cloud. As the needs and usage of the application grow, because LightSwitch applications run on the .NET Framework, and use the Visual Studio project system, they can be opened in Visual Studio 2010 Professional and higher, enabling more sophisticated customization of the application.

Can LightSwitch make LOB applications for Windows Phone 7?

LightSwitch is intended for building line-of-business applications that connect with existing applications, legacy systems, Web services, and the cloud. LightSwitch includes support for a variety of form factors, however; development for applications running on mobile devices is not supported at this time. LightSwitch supports publishing applications to the desktop, a web server, or the cloud (publish to cloud is not available in Beta 1).

Does LightSwitch use WPF for desktop applications, and Silverlight for Web applications?

LightSwitch currently creates Silverlight 4 applications. Since Silverlight 4 supports running out-of-browser, or in-browser, LightSwitch can easily generate the application form factor that you prefer.

How do I open a LightSwitch application in Visual Studio Pro?

There is no magic here. LightSwitch is a Visual Studio product. It uses the Visual Studio shell, and the Visual Studio project system. LightSwitch applications are Visual Studio applications. To open a LightSwitch application in Visual Studio 2010 Professional, simply open the .lsproj (LightSwitch Project) or .sln (Solution) file. Of course, you will need the LightSwitch runtime to support the application. If you have Visual Studio 2010 Professional (or higher) installed, simply install Visual Studio LightSwitch. The LightSwitch runtime and LightSwitch project templates will be installed and available through Visual Studio 2010.

When I define a new data source in LightSwitch, what is being created?

LightSwitch can work with several types of data sources, including Access (not available in Beta 1), SQL Server/Azure and SharePoint. If you decide to create a new data source (aka Application Data in LightSwitch lingo) you are defining a new SQL Server database. Under the covers LightSwitch uses SQL Server Express and creates a new ApplicationDatabase.mdf file for the new, local application data. You can also define new tables in other connected data sources (provided your credentials have the permissions to create tables). For example, you can connect to an existing SQL Server or SQL Azure data base, and choose the Add Table option to create a new table on your remote data source. If you don’t have the appropriate permissions, the Add Table option will not be available (as shown here).

How is LightSwitch different than WebMatrix?

WebMatrix is a tool that includes a Web server (IIS Developer Express), a database (SQL Server Compact), and programming framework (ASP.NET). WebMatrix makes it easier to create new websites from scratch, or use Microsoft’s Web Application Gallery to customize popular ASP.NET and PHP open source community applications. It is targeted at non-professional developers, primarily. Although WebMatrix seamlessly integrates with Visual Studio’s professional development tools, it’s not related to LightSwitch. In contrast, LightSwitch is targeted at professional developers looking to create custom LOB applications leveraging data from multiple sources that can be easily deployed to the desktop or cloud.

Does LightSwitch support version control?

Yes. LightSwitch comes with the Visual Studio Team Explorer installed making connecting to Team Foundation Server easy.

Does LightSwitch support custom controls?

Developers can create custom controls, themes and skins for LightSwitch applications. This is done in Visual Studio 2010 Professional and made available as a vsix installation (the Visual Studio Gallery is supported).

LightSwitch is great for developers (also overheard as ‘No it isn’t’)

Its important to understand the role LightSwitch will play in the world of a professional developer. If you are a Coder™ (make your living, or aspire to make your living writing code), LightSwitch may not be for you. Of course, you may use the LightSwitch runtime and project type inside Visual Studio 2010 Professional if you want to quickly build an LOB app or jump start some project development, but typically this isn’t you. The real user of LightSwitch is probably Code-Enabled™ (someone who has some basic coding skill – not like you – who will write or copy-and-paste code as needed to get what they need done). These are typically professionals in some industry who need apps for projects or specific needs, who you can’t be bothered with (think of the account manager who keeps asking you to build a tracking tool for them, and who you reject because you don’t have time). The reality is that there are a lot of Code-Enabled™ out there, and they will find a way to build what they need. The pain for you comes when their app “grows up” and you inherit it, are tasked with maintaining it, or worse yet, have to extend it. This is really when LightSwitch is good for developers. If the LOB app was built with LightSwitch, you are now inheriting a .NET based application, build on standard best practices (such as n-tier architecture with clear tier separation, data in SQL Server, proper data architecture, validation on the appropriate tiers, etc.). So while you may be thinking LightSwitch is not for you, it can still make your life better.

I promise more to come, including some demos. In the meantime, check out Jay Schmelzer’s The Anatomy of a LightSwitch Application Series.

D7