• An Introduction to LightSwitch – Edmonton Dot Net User Group Presentation – September 12, 2011

    Posted Sep 13th, 2011 By in .Net Development, LightSwitch With| 1 Comment | An Introduction to LightSwitch – Edmonton Dot Net User Group Presentation – September 12, 2011
    Share on TwitterSubmit to StumbleUponSave on DeliciousDigg ThisSubmit to reddit

    The following slide deck was presented at the September 12, 2011 Edmonton .Net User Group meetup…

    …please forgive me for the shameless header image of me at the presentation. I am usually quite shy :)

    Slide 1

    • So, as mentioned, my name is Paul Patterson.
    • I work for an organization named Quercus Solutions Inc. We are a technology based company specializing in Microsoft technologies such as .Net, SharePoint, Office 365, and Microsoft Azure.
    • First off, by show of hands, how many of you have had an opportunity to play with LightSwitch at all?
    • Cool. So most, if not all, of the information I have is probably already familiar to you – which is good because if I fail on something, I will call on you to bail me out. J
    • So, what I am going to present to you is a summary of what Microsoft Visual Studio LightSwitch is, and what it may mean to you as a professional software developer, as well as what it may mean to you as a “non-programmer”. Probably more so for the non-programmer.
    • With this presentation, I will be talking with the perspective of the non-professional software developer – those departmental people who may look at LightSwitch as an option to solving a business problem, for example.

    Slide 2

     

    • So, just so you know what to expect, here is a quick look at an agenda.
    • I’ll first give you a quick introduction to LightSwitch, in which will include a peak at the technologies that make LightSwitch tick.
    • The introduction will include a quick demo where I’ll put some what is presented into practice.
    • Next I’ll touch on some extensibility points about LightSwitch.
    • And then, with time permitting, I’ll skim over a few deployment points, and possibly show a quick deployment scenario for you.
    • As far as questions go; at the risk of not having enough time to get through the presentation and demos, if we could hold on to the questions until the end, we might be able to get through the entire presentation.
    • Having said that, I have to caveat that LightSwitch is a huge topic. We could easily spend an entire day going through all the fine details of LightSwitch. Given the 1 hour time box here, I have to cover the higher level points, so I totally expect some questions; just if we can hold off until the end, that would serve us best – thanks.

    Slide 3

    • So, according to Microsoft… in using Microsoft Visual Studio LightSwitch 2011, we, “…will be able to build professional quality business applications quickly and easily, for the desktop and the cloud.”
    • Okay! First off, I am not a designated LightSwitch “Champion”. I am just a curious fella who happened onto something that tweaked my interest a few years back.
    • Before you start laying into me with some subjectivity, you should first understand where I coming from, and how I think.
    • I generally like to find things that help me take care of a task in as short a time as possible.
    • This probably came from the various roles as the technical go-to guy within the non-technical departments I’ve worked in.
    • A lot of my early experience to solving business problems involved the use of Excel and Access.
    • When I first read about this tool that Microsoft was working on, one that had the potential to do something fast and easy; I was intrigued.
    • I started watching the development of LightSwitch very early on, even before the first beta was released.
    • I believe it was at sometime in 2008, maybe 2007, that Microsoft made people aware that it was working on this new tool codenamed KittyHawk.
    • Rumour had it that the KittyHawk team included some former FoxPro people – which would make sense because of the timing of FoxPro’s retirement.
    • Anyways it was sometime early last year that I read about this LightSwitch tool that Microsoft was readying for beta testing.
    • After culling through some forums and interweb rumour mills, I took it to task to keep a diligent eye on this thing – hence the start of my blog PaulSPatterson.com.
    • So, since early last year I have been keeping my ear to the ground, listening and watching how this product has evolved in to what it is today.

    Slide 4

    • So why did I tell you all that!
    • I am going on my intuition and gut instincts that LightSwitch is going to have a relatively large impact on the industry. Maybe not tomorrow, or even within the next year, but something is telling me to keep an eye on this tool.
    • Software developers tend to keep some technologies close to their chest.
    • All I am saying is to keep an open mind about LightSwitch, and don’t discount the obvious – such as the value proposition the product has.

    Slide 5

    • Back to the agenda, let’s talk about the technology behind LightSwitch…

    Slide 6

    • LightSwitch is a part of the Visual Studio family of products.
    • It essentially sits as a SKU between Visual Studio Pro and the free Express products.
    • I believe the current retail price for LightSwitch is about $200.00.
    • When you install LightSwitch, if you already have Visual Studio 2010 (Professional or better), it automagically integrates with Visual Studio, making its templates available for selection from the new project templates dialogs.
    • If you don’t have Visual Studio installed, LightSwitch installs as a stand-alone tool; using the same familiar Visual Studio IDE.
    • Using LightSwitch, it is possible to create and deploy an application without writing a single line of code.
    • As such, you can already begin to imagine the value proposition that this will have with the non-developer types.
    • Like I said before, LightSwitch is data centric, and all that someone has to do is provide some data, select to add some screens for the data, and presto, you have an application ready to show off to all your work buddies.
    • It really is just that easy! (That is Shell Busey, home improvement guy!). Yes, I just dated myself

    Slide 7

    • LightSwitch uses “best practices” in how it creates applications.
    • For example, LightSwitch applications are built on a classic three-tier architecture where each tier runs independently of the others and performs a specific role in the application.
    • Here is an example 3-tier architecture model. The presentation tier (or “UI”). The logic tier which is the liaison between the presentation tier and the… data storage tier; which is responsible for the application data.

    Slide 8

    • We can map specific technologies used in LightSwitch to this architecture.
    • The presentation tier is a Silverlight 4.0 application.
    • It can run as a Windows desktop application or any hosted in a browser that supports Silverlight
    • Which by the way can be done on Mac, I’ve done it, I just can’t remember if it was Chrome or Safari that I got it to work in.
    • For the logic tier, WCF RIA DomainServices is used.
    • The logic tier process can be hosted locally (on the end-user’s machine), on an IIS server, or in Windows Azure.
    • For the data tier, a LightSwitch application’s primary application storage (for development) is SQL Server (SQL Express) technologies.
    • This database access is accomplished via an Entity Framework provider, and custom build WCF RIA DomainServices.
    • There are also opportunities to consume other data sources, which are exposed, typically, via WCF RIA services – oData is a good example.
    • The idea is that LightSwitch removes the complexity of building three-tier applications by making specific technology choices for you so that you can concentrate on the business logic and not the plumbing.
    • Silverlight!! LightSwitch builds out applications using Silverlight.
    • When you create an application using LightSwitch, you are essentially creating an application that uses Silverlight technologies.

    Slide 9

    • Back to the agenda…
    • So, next I want to talk a little about what is meant by Screens over Data.

    Slide 10

    • It all starts with the data.
    • Data is the heart and foundation of developing with LightSwitch.
    • Most everything we do in LightSwitch revolves around the data.
    • In a nutshell, you tell LightSwitch what to use, and then you create the “screens” that fit over the data. More to come on that later…
    • A LightSwitch application can connect to two types of data: local or internal data and external data.
    • With local data, SQL Server Express is used behind the scenes.
    • When you start designing entities in LightSwitch, which I’ll show you an example of in a second, you are using SQL Express.
    • External data can be consumed from SQL Server databases, SharePoint lists or any WCF RIA Service exposed data.
    • With external data sources, LightSwitch can perform data management, such as CRUD operations, however it cannot make any schema changes on the data source.
    • Note that WCF RIA Services can expose a lot of different types of data sources.
    • If you can wrap a data source in a WCF RIA Service, chances are you can consume the data source in LightSwitch; such as OData, for example – which I have done, as shown in my blog where I consumed some City of Edmonton data to view bus stop information.
    • Also, LightSwitch can also connect to more than one data source at a time, and internally, define relationships between external data sources and internal data entities, if any.

    Slide 11

    • So where are we at with the agenda?

    [/arrow_list

    Slide 12

    DEMO TIME!!

    • Launching LightSwitch
    • The IDE – Just like Visual Studio (because it IS Visual Studio)
    • New Project Dialog
    • LightSwitch Start Screen – shows how data is the center of attention
      • Create new table and Attach to external Data Source items
    • Create a new table.
      • Example Customer Table…
      • Explore the Table Designer
        • Field Name
        • Different Data Types
        • Required Checkbox
        • Explore the field properties panel
          • General
            • Choice List
            • Appearance
              • Custom Validation
              • Create custom validation on date field…
              • Private Sub DateAdded_Validate(results As EntityValidationResultsBuilder)
                
                If DateAdded.HasValue Then
                
                If DateAdded > Date.Today Then
                
                results.AddPropertyError("The date added must be today or in the past.")
                
                End If
                
                End If
                
                End Sub
    • Add a screen for the Customer table
      • Explore the add new screen dialog
      • Select List and Details Screen template
        • Select Customers data.
          • Note how the data is “pluralized”
      • Explore the Screen Designer
      • Not your familiar GUI designer.
      • Screen Members List
      • Screen Content Tree
      • Run the application
        • Show Customers screen
        • Add a customer
          • Show phone number formatting
          • Show phone number drop down selection
          • Show date validation
          • Show save data feature
          • Show debug mode designer features…
            • Demonstrate real-time customization
              • Change labels of detail fields
              • Add Description to field to show field tooltip.
    • Explore the Solution Explorer.
      • Folder structure
        • Data Sources
        • Screens
        • Add a new “Address” Table
        • Update the AddressType field to use a ChoiceList
        • Add a relationship to the Customer table.
          • Demonstration the add relationship dialog
          • Show resulting screen designer with the relationship.
    • Delete the existing screen
    • Add a new List and Details screen
      • Select the Customers data for the screen.
      • Show how the Customer addresses is available for selection.
      • Select the addresses to show on the screen.
    • Review the screen designer showing the additional entity collection for the addresses.
    • Run the application and review the new address collection on the screen.
    • Create a new table named City, using just the CityName as a field.
    • Edit the Address table by removing the City field, and then add the relationship to the new City table.
    • Open the CustomerListDetail screen and show how the screen has removed the City field.
      • Drag and drop the field from the Addresses collection to the Addresses data grid.
      • Also, move the Address Type item to the top of the list of items.
    • Create a new Editable Grid screen that will be used to maintain the list of cities.
    • Run the application.
      • Ask if anyone notices anything about what gets displayed…
        • Two things, the address type field, and
        • The address record that was added earlier was deleted.
          •  This is because of the edit to the address entity. There was a field removed, and a relationship created, which basically refreshed the model.
    • Show the available navigation on the left Task menu.
    • Select the editable Cities grid and then add some cities.
    • Go back to the Customer List Detail and add some addresses for the customer.
    • Close the app
    • Review the project properties
      • General Properties
        • Shell: The placement and behaviour of elements on a screen
        • Theme: The look and feel (colors and things like that). CSS for the most part.
        • Extensions
          • Used for implementing custom shells, themes, controls, business entities, and whatever your creative heart desires.
          • Access Control
            • Review the different types of authentication that can be implemented
            • Application Types
              • Desktop and Web
              • Application Server.
              • Screen Navigation
    • Create a new group named Lookups
      • Add the Editable Cities Grid screen to the Lookups group
      • Remove the Editable Cities Grid screen from the Tasks group
    • Run the application and demonstrate what has changed.

     Slide 13

    • Agenda

    Slide 14

    • Now, instead of talking about developing with LightSwitch, we’ll talk about developing for LightSwitch.
    • Thinking about the target market for LightSwitch, extensions are meant to provide the means for LightSwitch developers to enable additional capabilities, with very little effort.
    • Extensions can be created to include additional features and capabilities for;
      • Themes and Shells,
      • Screen Templates,
      • Custom Business Types,
      • Data Sources,
      • Controls, And
      • Starter Kits and Toolkits
    • Extension development is a topic on its own, and worthy of another presentation if you like.
    • There is already a market for extensions, and the extension ecosystem is growing.
    • There are plenty of free extensions available, as well as paid for premium extensions.
    • The major vendors, including our sponsor Telerik, already have products that can be implemented into LightSwitch development.

    Slide 15

    • Agenda

    Slide 16

    DEMO TIME AGAIN

    • Open Extension Manager in Visual Studio
      • Open Online Gallery in extension manager and filter by “LightSwitch”
    • Install a Theme extension
      • Enable the extension and use it and show it in the application as it runs

    Slide 17

    • Agenda

    Slide 18

    • LightSwitch applications can be deployed as an application that runs on a desktop, or via the web.

    Slide 19

    • Agenda

    Slide 20

     

    • Open EDMUGLSDemoapplication and show Application types
      • Review Desktop Client
      • Web Client
      • Application Server
    • From Application Type, choose Web client.
      • Click the Publish button
        • Client Configuration: Web
        • Application Server Configuration: IIS Server
        • Publish Output: Remote Publish to a Server Now
        • Database Connections:
        • Specify a Certificate: nothing
        • Summary: Click the publish button.
    • Go to the server and review IIS
    • Review the newly installed SQL database.
    • Launch the application from a web browser
    • Add some customers.
    • Now let’s add some security…
    • Back in project, select the Access Control tab.
    • Select to use Forms Authentication
    • Go back into the Application Type tab and select Publish
    • Review the new Authentication information.
      • Select Yes, create the Application Administrator….
        • UserName: Application.Administrator
        • Password: P@ssw0rd
        • Select Publish
    • Go to the web site and login using the application administrator
    • Create two users, Paul.Patterson and Joe.User.
    • Assign Paul.Patterson with the administrator permission.
    • Close the browser and then reopen and login as Paul.Patterson
    • Note the administrator feature in the task bar
    • Close the browser and then reopen and login is Joe.User.
    • Note that the administrator feature is no longer there.
    • Time Permitting; Create role based security
      • Create an AddressType table.
      • Create an EditableAddressTypesGrid
      • Create a new LookupTables permission in the AccessControl tab of the application properties.
      • Edit the CanRun code:
        Private Sub EditableAddressTypesGrid_CanRun(ByRef result As Boolean)
        result = User.HasPermission(Permissions.LookupTables)
        
        End Sub
    • Publish the application
    • Open the application in the web browser(login as Paul.Patterson)
    • Create a Role named Application Settings
      • Assign the LookupTables permission to the role
    • Save
    • Assign the Application Settings role to the Paul.Patterson user.
    • Close the browser, and the launch it again and login in as Paul.Patterson.
    • The screen should now be available.

    Slide 21

    • Question and Answer time.

    [/arrow_list

    Slide 22

     

    • My blog at http://www.PaulSPatterson.com
    • Microsoft Visual Studio LightSwitch 2011 Site – http://www.microsoft.com/visualstudio/lightswitch
    • MSDN LightSwitch site: http://msdn.microsoft.com/lightswitch
    • Michael Washington’s web site: http:/.lightswitchhelpwebsite.com
    • Many more resources and references on my own blog.

    • delicious
    • digg
    • reddit

    Paul
    My name is Paul Patterson and I am a software developer who has a keen interest in technology, including; open source, .Net, and anything Interweb. When not crafting some code, I can be found learning something new about photography. As well, I occasionally escape to the "music room" with my guitars to practice a few scales and then jam with my favourite FM radio stations.

Leave a Reply


Comments (1)

Reply
Victor » 14. Oct, 2011

Good information.

© Copyright Paul S Patterson - Please, no touchie. :)