Skip to content

Lesson 4: A Complete Example

Donald Roy Airey edited this page Feb 7, 2019 · 8 revisions

We've learned the basics of creating a data model from an XML Schema (XSD) description. We've also learned how to resolve parent key elements using a symbolic lookup. In this lesson we're going to build a real-life write-through cache using a cloned project from GITHUB.

Step 1

Go to the location on your disk where you store your source files and type

git clone https://github.com/GammaFour/subscription-manager.git

In this directory you'll find two solutions: Subscription Manager.sln is a complete Web Application with a RESTful API and a write-through cache. Loader.sln is a simple program to import the scripted data that you might create for a test-driven design (TDD). The data in this project will illustrate some of the key points of the generated REST API.

Step 2

Open up Subscription Manager.sln in your IDE. Build it using Ctrl+Shift+B

Step 3

For this step you'll need access to either an SQL Database or a Postgress Database. In the Web Application project, open up the appsettings.Development.json file by double-clicking it. You should see:

{
  "DbProvider": "SqlServer",
  "ConnectionStrings": {
    "SqlServerConnection": "Data Source=localhost;Initial Catalog='Subscription Manager';Integrated Security=True",
    "PostgreSqlConnection": "Server=localhost;Database=investment_management;Port=5432;User Id=postgres;Password=password"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}

Navigate to the Package Manager Console using the menu selection Tools > NuGet Package Manager > Package Manager Console. In the console, type:

Add-Migration InitialMigration

Clone this wiki locally