Building Job Ads Management Module With LightSwitch Beta 1 For Silicon Valley Code Camp


The End Result




As you can imagine, The Silicon Valley Code Camp web site has lots of “back end” functions that need to be done. That is, things like doing mailings, assigning roles to users, making schedules, allocating rooms and times and literally  hundreds of other tasks like that.  Over the 5 years of code camp, I’ve always built simple protected web pages to do this.  I’ve always used the simplest control I could find, such as GridView, DetailsView, DropDownList, and SqlDataSource.  The interfaces usually basically work but are very clumsy and lacking in both functionality and aesthetics.


Why Now

I’ve seen lots of short demos on LightSwitch for Visual Studio and recently read on someone else’s blog that they are now building all their simple applications using LIghtSwitch.  Also, my friend Beth Massi has been running around the world espousing the greatness of this product and I knew if I ran into any dumb issues that she’d bail me out (I’m the king of running into dumb issues.  I’ve found that given two choices that seem right, I always pick the wrong one which is what actually happened here along the way, and Beth did bail me out).


First Blood

First thing to do (after installing LightSwitch) is to say “File/New/Project”.  My plan is to add this project right off my SV Codecamp solution.  So, here goes.


So far so good.  Next step is to choose attach to an external database


Continuing, but don’t get tripped up here like I did.  You will use WCF RIA Services under the covers but you don’t want to select that choice.  You want to say that you want to connect to a database and let LightSwitch do the work for you.


PIck your database and connection strings.


Now, pick the tables you plan on working with.  If this were Linq2sql, I’d be choosing them all, but now that I’m in RIA Services land, I’m hoping I can  have separate “Domains” and not have to reference all the tables all the time.  Jury is still out on that one but for now, I’m following the advice of the team and just picking the tables I want to manage now.


And, I’m going to name the Data Source “svcodecampDataJobs”.  I’ll have to see how this goes and report later.  I’m doing this live so I really don’t know where I’ll end up.

click finish, then rebuild all and it  all works.  It comes up with this screen showing me my relationship between the tables. It is showing me a Company table with a link to a JobListing table which is what I have. Here is what LightSwitch shows me.


The reality of my database is that I also have a JobListingDates table that is now shown here.  Taking a step backwards to explain my database, I have a simple company table, the company has a detail table associated with it called JobListings, and the JobListings table has a details file associated with it called JobListingsDates.  That is, a company may run an ad for 30 days, take it down for 30,and bring it back up again.

Here is what that schema actually looks like in SqlManager from EMS.



One thing I like about great software is that it has things that are discoverable.  So, just now, I double clicked on the little table called JobListings and the view changed to having JobListing as primary and if you look on the bottom right, it shows JobListingDate.  Very cool.  I have no idea where this is all going but I’m starting to get excited.  Here is what I’m looking at now.



Building a Screen


So now, let’s push the “Screen” button and see what happens (while looking at the Company View).


This is nice, I get a list of sample screens.  How about if we build an Editable Grid Screen with the hope of editing and adding new Companies.  Notice that I’m naming it EditableGridCompany and chosing the Company for the data in the dropdown.


You now get a screen that is a little scary looking so rather than actually try and understand it, I thought “maybe I’m done, maybe this will just run”.  So, here goes, Debug/Start Without Debug.  Here is the scary screen, followed by what happens after the run.


And the Run:


Wow!  Paging, Fancy editing including date pickers, exporting to Excel, Inserts, Updates and Deletes on the company table.  This is amazing.  Let me add another Grid so that I can add JobListings to the company.  To do that, go back to the solution explorer and choose add screen.


Then again, I have choices.

I choose Details Screen and check Company in the dropdown, Company Details and Company JobListings for the additional data.


Another intimidating screen, but simply do Debug/Debug Start.



Well, that’s it for now.  Code Camp is 4 days away and I don’t really have time to take this to the next level.  You can see from the screen at the top of the post that this is pretty amazing for the effort!  I’m sure I’ll be back to this.

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


  1. Very helpful post man, thanks for the info.

  2. very good tutorial, big NERDTHX !!!

Your Comments


Protected with IP Blacklist CloudIP Blacklist Cloud


Get every new post delivered to your Inbox

Join other followers: