dbi services Blog
Welcome to the dbi services Blog! This IT blog focuses on database, middleware, and OS technologies such as Oracle, Microsoft SQL Server & SharePoint, EMC Documentum, MySQL, PostgreSQL, Sybase, Unix/Linux, etc. The dbi services blog represents the view of our consultants, not necessarily that of dbi services. Feel free to comment on our blog postings.
Overview of Microsoft Visual LightSwitch
Microsoft Visual Studio LightSwitch is a new application development tool wich allows to create fast and nice web and desktop applications.
The development environment is the same as the other .NET development tools and creating a new application with LightSwitch works, at the beginning, exactly like with other .NET application: create a new project and choose your programmation's language between Visual Basic and C#.
The following will change our habits. In fact instead of creating a screen where you place butons, labels, grids... and after add a data source to link these objects with your database in LightSwith you have first to create new tables or to attach an external data source and after you will be able to create screen against this data source.
Create or Attach a database
First screen when you create a new application:
If you choose to create new tables this required to have SQL Server express installed and running because it is where the tables will be store.
If you want to attach an existing external data source the source of that data can be a SQL Server database, SharePoint list, OData Sercive or WCF (Windows Communication Foundation) RIA (Rich Internet Application) Services.
Here we will attach an existing SQL Server database, so let see how to do that after having clicking the "Attach to external Data Source" link.
Click on Database as we will attach an SQL Server existing database and click the Next button to enter your connection properties.
After the connection you will see a screen with all database objects and you will be able to select those you need in your application.
Here we will select some tables and click the Finish button to import those tables in our application and be able to create screens against those objects.
Now we have our tables in our application
and we are able to add screens.
Add Screens to our application
For that you have just to right click on the Screens menu and select Add Screen. You will now have the possibility to select a screen template depending on what you want to display: details screen, editable grid screen, list and detail screen, new data screen or search data screen and for all those templates you will be able to select the data you would like to link with this screen and also if you want to add some additional data like for example children tables to a detail screen.
Let's create now a Search screen and a Detail screen with just some clicks.
We create first a search screen on the patient table:
Do the same to create a Detail screen on patient table with Consults and Reglements as additional data:
After the generation of each screen you get a screen editor where you can manage you screen by adding some buttons, removing or adding new fields, changing the design of the screen... all just by clicking around in the windows with self-explanatory.
After each modification you can Start your application and during the running period you have a button on the right/bottom of the screen "Design screen" which allows you to edit and to modify your screen and see immediately the result.
Our screens are as follow, the search screen:
The detail screen with Patient and also associated data:
All is really intuitive and you could create and design an application easily just with some clicks.
Of course you have also the possibility to add your own code which will correspond to an event like screen saved, screen closed or override code for a button.
For example when I click the Activated event i have directly the possibility to enter code in Visual Basic for this event which will be executed each time the screen will be activated.
LightSwitch provides an intuitive way to develop applications: you can quickly and easily add screens, write only the code you need in the language you prefer and you can deploy LightSwitch applications on the desktop, on the web or in Windows Azure.
You have also multiples ways to secure your application with windows authentication or create custom rules within LightSwitch related to the application.
As Jason Zander, vice-president of Visual Studio, said: Visual Studio LightSwitch is a simplified self-service development tool.