Posts Tagged ‘registration’

LightSwitch for Games Part 2: OData Tutorial and User Account Management on the Server

August 29, 2013 5 comments

NOTE: Although this series is aimed at small game developers, it is equally applicable to anyone wishing to learn how to use LightSwitch.

In part 1 of this series we looked at the rationale for using LightSwitch as a game data server and how to setup and publish a LightSwitch project on Windows Azure (optional). In this part, we’ll look at the server-side work needed to enable users to create their own accounts on the game network. We shall take a look at several client-side samples for registering and logging on in part 3 to complete the end-to-end process.

In this article, you will learn:

  • What OData is, how it works and the underlying HTTP messages it uses
  • How to use OData to retrieve and insert rows in your LightSwitch application database
  • How users, permissions and roles are organized in a LightSwitch application
  • How to create a desktop application to edit the users and roles in your application
  • How to create a WCF RIA Service which provides an updateable view of two tables
  • How to create an anonymous guest user with limited permissions (in this case, permission to add a new, real user)
  • How to limit a user to accessing only their own data in a particular table
  • How to create a user profiles table which can store additional information and automatically generates a new user in LightSwitch’s internal user authentication database when a new row (user) is inserted
  • How to automatically assign new users to roles

This article assumes some familiarity with:

  • HTTP (GET and POST methods, headers and request and response bodies)
  • a basic understanding of either XML or JSON
  • a basic understanding simple database structures (tables and rows) and basic SQL queries (SELECT and INSERT)
  • a moderate understanding of C# (but you can just copy and paste the code if you aren’t too familiar with C#)

NOTE: You need Visual Studio Professional 2012 Update 2 or Update 3, or Visual Studio 2013 (Preview) to complete the tutorials in this article. Note that in Visual Studio 2013 (Preview), the organization of items in Solution Explorer has changed so some items may be in different places to those indicated below. Read more…

%d bloggers like this: