DPS907 WSA500 Lab 3

Work with associated entities. Use the repository and unit-of-work patterns.


Read/skim all of this document before you begin work.


DPS907 WSA500 Lab 3 – Due Tue Sep 30

Due date: Tuesday, September 30, 2014, at 8:00am ET

Grade value: 3% of your final course grade

If you wish to submit the lab before the due date and time, you can do that.



Work with associated entities.

Implement the repository and unit-of-work patterns.

Deploy to a public Microsoft Azure web site.


Introduction to the problem to be solved

A record label needs to publish a web service for its music.

There are three data entities in the problem domain:

  • Artist
  • Album
  • Song

For this programming task, simple associations will be maintained:

  • An Artist can have zero or more Albums (and an Album is associated with a single Artist)
  • An Album can have zero or more Songs (and a Song is associated with a single Album)

(Yes, it is acknowledged that these associations aren’t real-world true, because of artist collaborations, and songs that appear on multiple albums. Maybe you’ll ‘fix’ this later in the course.)

Your work will use the recently-learned ‘repository’ and ‘unit-of-work’ patterns. And of course, follow best practices. (Show this list as a separate post?)

  • Data annots, design model classes
  • Data annots, resource model classes
  • Code comments
  • Nice readable code
  • Appropriate web app home page
  • Return results are ordered (sorted/sequenced) in a useful manner
  • Tests (in Fiddler etc.) cover all use cases, including error conditions
  • etc.

For the Artist and Album entities, implement this functionality:

  1. Get all
  2. Get one by its identifier
  3. Add new

The “get one by its identifier” function must include the appropriate next-level (resource model) collection. For example, the Artist ‘get one…’ will return the Artist, and the Album collection. The Album ‘get one…’ will return the Album, and the Song collection.

For the Song entity, implement more functionality:

  1. Get all
  2. Get all, filtered to match a search condition (e.g. song name)
  3. Get one by its identifier
  4. Add new
  5. Edit existing
  6. Delete existing

The “get all” function must include the album name and the artist name.

The “get one by its identifier” function must include the appropriate Album (resource model) object, and the appropriate Artist (resource model) object.


Specifications and work plan

Your professor has created a project that you can use as a base. It will build correctly and run successfully. However, you must add features and functionality.

It has been posted in the “Assignments” area of My.Seneca course (nearby the submit link).


Getting started

The name of your project will be “Lab3″.

Make a copy of the downloaded project base, and (as noted above) name it “Lab3”.

As you perform each step, test your work, to ensure that you’re making error-free progress:

  • Build/compile
  • Where appropriate, use Fiddler


Component configuration

Use the recently-learned repository and unit-of-work patterns.

Organize your classes as follows:

Models folder

  • No change, it continues to hold the data context and design model classes (source code files)

Controllers folder

  • For the controllers; each controller has a reference to the unit-of-work class
  • Also holds the resource model classes (source code files)

ServiceLayer folder (new)

  • Repositories
  • Unit of work

Add ‘using’ statements to import the classes from the appropriate design models and resource models namespaces.

The per-entity repository classes will do most of the work. Controllers will use methods in these classes through the unit-of-work reference.


Testing your work

Use Fiddler.

Ensure that it has been configured to save the message bodies in requests and responses.

Test all scenarios (use cases). Make sure that you test error conditions too.

Remember – when sending the entity body with a PUT request, you must include the object’s identifier.

Saving – ‘exporting’ – your tests

On the left side list of requests, you can delete items that you don’t want included in the export.

When you’re ready to save, choose File > Export Sessions > All Sessions…

The export format will be “HTTPArchive v1.2″. Click the Next button to choose a save location (your project’s root, in the same folder as the “packages” and “lab2″ folder) and specify a filename. Name the file by using the project name (e.g. “lab3.har”).


Deploy to Microsoft Azure

Please visit the September 11 notes page for instructions.

If you have done the right configuration actions, this current “Lab3” project will completely replace the “Lab2” project that you published earlier.

During grading, your professor will attempt to interact with your web site by using the ‘customname’ value (see the Sep 11 notes page instructions).


Reminder about academic honesty

You must comply with the College’s academic honesty policy. Although you may interact and collaborate with others, you must submit your own work.


Submitting your work

Here’s how to submit your work, before the due date and time:

1. Locate the folder that holds your “Lab3″ project files.

2. Make a copy of the folder. This is the data that you will be uploading.

3. Remove the “packages” folder from the copied folder; also, remove the “bin” and “obj” folders.

4. Compress/zip the folder. The zip file SHOULD be about 1MB or less in size. If it isn’t, you haven’t followed the instructions properly.

5. Login to My.Seneca. Open the Web Services Architecture course area. Click the “Assignments” link on the left-side navigator. Follow the link for this lab. Submit/upload your zip file. The page will accept three submissions, so if you upload, then decide to fix something and upload again, you can do so.

















  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: