Click here to Skip to main content
15,567,466 members
Articles / Programming Languages / C# 4.0
Posted 8 Dec 2011

Tagged as


14 bookmarked A Visual Studio LightSwitch Application

Rate me:
Please Sign up or sign in to vote.
4.94/5 (8 votes)
8 Dec 2011Ms-PL6 min read
Describing how the site uses Visual Studio LightSwitch for its back-end

Image 1

An HTML Website that Uses Visual Studio LightSwitch

LightSwitch is a powerful application creator. However, you may need HTML pages. LightSwitch can still be used for all processes that do not need to be HTML.

In this article, we will explore a real-world project I recently completed. It is a LightSwitch application that manages the site. The reason the site needed a LightSwitch application to manage it, is because it has requires the following functionality:

  • HTML (.aspx) web pages
    • Allow anonymous users to submit “Posts”
    • Display Blogs (created by Dave based on “Posts”)
    • Allow search by category
    • RSS Feeds
    •  Blog Posts
      • “In This issue” list of each author (with link to their post)
      • “Above The Fold” (with link to their post)
      • Shoutouts
      • “Post” description uses the Blog Post Text field (not the synopsis)
    • Searchable database of “Posts”
  • LightSwitch Application
    • Category administration
    • Allow “Posts” to be searched (using Filter control) and edited
    • Button to Email the Author
    • Tweet This button that points to the database entry
    • Blogs
      • Edit Blog Footer and Header (used for new Blogs does not change existing Blogs)
      • Enter and edit “Shout Out” entries
      • Tweet button for entire Blog Post
      • Create/Edit Blog
      • Select “Posts” from database that are not already included in a Blog post
      • Edit Administrative fields such as “BlogPostText” and “IncludeInAboveTheFold
      • Edit any Blog using Telerik Rich Text Editor (this allows Blog posts to be created that do not consists of database “Posts”)

However, let me first answer the questions required of the LightSwitch Star Contest:

What does your application/extension do? What business problem does it solve?

This application allows Dave Campbell to easily manage the database of posts, and to create the Blogs on

How many screens and entities does this application have?

Five screens and six tables

Would this application still be built if you didn’t have LightSwitch? If yes, with what?

ASP.NET Web Forms were currently being used for the site management. To enable the enhancements, it would take dozens of hours that were not available. So no, the project would not have been completed without LightSwitch.

How long did this application take to actually build using LightSwitch?

About 8 hours for the LightSwitch code and 12 hours for the ASP.NET pages.

Does this application use any LightSwitch extensions? If so, which ones? Did you write any of these extensions yourself? If so, is it available to the public? Where?

This project uses the LightSwitch Filter Extension, and the Telerik Rich Text Editor.

How did LightSwitch make your developer life better? Was it faster to build compared to other options you considered?

Massively faster!

The Email From Dave Campbell

This project started when I asked Dave Campbell to send me an email describing how he processes posts for the site (the precursor to the site):


From: Dave Campbell
To: Michael Washington
Subject: WindowsDevNews

How I currently roll up a blog post
(or, how painful can this really be)

I get submittals as email… most of the information I can copy/paste over except for the URL shortening, but that’s just a button press. I use their info or part of it in the synopsis that goes on the site, but may still type my own comment. So it’s mail open, submittal form open, copy/paste a bunch of fields, read/skim the post, bang up some commentary. I post it to twitter also during this manual process. And… All posts are also submitted to a secondary form that inserts them in the big tag cloud at

For ones I find myself, I may have to search out the author’s name, I have to shorten the URL, rat out a synopsis, figure out the tags, type my comments, then post to twitter and the two submit forms (SilverlightCream and

When I’ve got enough for a post…

Near the bottom of my admin form is a piece I’ve built that I cut and paste to the top “In this edition” section of contributors names and links into the body.

I also have the formatted up links with anchor tags for the body of the post, and I paste those in.

Then I go through and deal with any multiple article issues from a single dev (with the (-2-, -3-) tagging .. I wrote a macro in my editor to do the -2- but anything beyond that is free-form coding.

Then I copy/paste my comments into the boilerplate I previously pasted in from my admin page… interleaving with the author’s name

Then I run it locally to make sure it’s formatted correctly.

Reading through it, I decide on the ‘above the fold’ entries, and insert that information manually… I’ve got markers set up for it in the html template.

Then I refresh it locally.

If it looks good, I log into GeeksWithBlogs, start a new post, copy/paste the markup into the GWB box, select the tags and post

Then I open the post in a new tab, get the shortened URL and send it out on twitter.

That sounds like a LOT of work… and I suppose it is, but it’s a rhythm I’ve gotten into and it isn’t really as painful as it sounds unless I’m tired… like last night and just said heck with it...

This is the basic architecture I came up with:

Image 2

Below is the database structure. This basically copies the original site (because the data from that site will eventually be imported into the new one), and I simply connected the tables in LightSwitch as external data:

Image 3

The Program Flow

Image 4

The process starts when a visitor submits a post to the database.

Image 5

Dave periodically logs into the LightSwitch application, and using the Filter Control Extension, searches for new Posts and performs the following functions:

  • Set the Post to show in the database
  • Flag the Post to show in a Blog
  • Set the Post to show "Above The Fold" in the Blog
  • Enter the Blog text for the Post
  • Change the categories for the Post
  • View the web page for the Post
  • Send an email to the Poster
  • Post to Twitter about the Post

Image 6

On the Blog administration screen, Dave can create or select a Blog and edit the Posts.

Image 7

The Add Post button will automatically find any Post marked to be included in a Blog, but not currently associated with a Blog.

Image 8

Dave updates the Header and Footer that will be used for all new Blogs.

Image 9

He simply clicks the Generate Blog button to create or update the Blog post.

After the Blog is generated, he can edit the text and even add pictures.

Image 10

The public side of the site shows the Blogs.

Image 11

It also shows the Posts in a searchable database. 

Source Control And Hosting

When the site was completed, I posted it to the server provided by DiscountASP. I checked the entire solution into the TFS Hosting account that they also provide.

LightSwitch Is Up To The Task

I hope this project demonstrates that LightSwitch is capable of handling any of your projects with a 90%+ savings in code and time.

There are a ton of tutorials, tips, blogs, and forums at:

Image 12


  • 8th December, 2011: Initial version


This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Written By
Software Developer (Senior)
United States United States
Michael Washington is a Microsoft MVP. He is a ASP.NET and
C# programmer.
He is the founder of,, and

He has a son, Zachary and resides in Los Angeles with his wife Valerie.

He is the Author of:

Comments and Discussions

GeneralMy vote of 5 Pin
Monjurul Habib9-Dec-11 10:30
professionalMonjurul Habib9-Dec-11 10:30 
GeneralRe: My vote of 5 Pin
defwebserver10-Dec-11 5:29
defwebserver10-Dec-11 5:29 
GeneralMy vote of 5 Pin
PaulSPatterson9-Dec-11 5:59
PaulSPatterson9-Dec-11 5:59 
GeneralRe: My vote of 5 Pin
defwebserver9-Dec-11 9:04
defwebserver9-Dec-11 9:04 
QuestionNot too much? Pin
Paul Selormey8-Dec-11 19:10
Paul Selormey8-Dec-11 19:10 
AnswerRe: Not too much? Pin
defwebserver8-Dec-11 19:16
defwebserver8-Dec-11 19:16 
GeneralRe: Not too much? Pin
Paul Selormey8-Dec-11 19:45
Paul Selormey8-Dec-11 19:45 
defwebserver wrote:
Did you see the part where I implemented a ton of functionality in only 8 hours?

I thought I read...

defwebserver wrote:
About 8 hours hours for the LightSwitch code and 12 hours for the ASP.NET pages.

Now, since that does not specify the time required for design and planning, hard to make any sense of it.

With a good freely content management system, that site should be done within maximum of 3 days, including one day designing.
Neither me nor the customer will have to pay for LightSwitch.

Best regards,

Jesus Christ is LOVE! Please tell somebody.

GeneralRe: Not too much? Pin
defwebserver8-Dec-11 19:51
defwebserver8-Dec-11 19:51 
AnswerRe: Not too much? Pin
PaulSPatterson9-Dec-11 6:04
PaulSPatterson9-Dec-11 6:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.