Project Description
A collaboration framework for occasionally connected smart clients and web applications. Store data on the device, push it to the server, and synchronize with other devices. Give your users a customized native application, or gracefully degrade to HTML on other devices.

Set up a distributor

Go to http://correspondencecloud.com to set up a Correspondence distributor. This is how devices running your app will collaborate with each other.

Download using NuGet

Create a portable class library for your model. Add the package:
  • Correspondence.Model

Create another portable class libraries for your domain services, view models, and other shared code. Add the package:
  • Correspondence.Core

Add the app package that's right for your application:
  • Windows Store, Windows Phone, WPF, or Silverlight - Correspondence.App
  • MVC - Correspondence.Web.App

Create a unit test library and add the package:
  • Correspondence.UnitTest

See the Readme.txt file for additional instructions.

Step 1: define a fact
You express your model in a language called Factual. A fact looks like this:
fact Message {
key:
    Conversation conversation;
    User sender;

    string body;
}


Step 2: add a fact to the community
Adding a fact stores it in the local database and publishes it for other peers.
public partial class Conversation
{
    public void SendMessage(User sender, string body)
    {
        Community.AddFact(new Message(this, sender, body));
    }
}

Step 3: query for related facts
A query is expressed in Factual as part of a fact. The colon (:) is pronounced "such that", as in "messages is the set of Message facts m such that m.conversation is this Conversation".
fact Conversation {
    // ...

query:
    Message *messages {
        Message m : m.conversation = this
    }
}


Step 4: access query results
Query results appear as an enumerable property of the fact. The results are bindable, even through a view model:
public class ConversationViewModel
{
    private Conversation _conversation;

    public ConversationViewModel(Conversation conversation)
    {
        _conversation = conversation;
    }

    public IEnumerable<string> Messages
    {
        get
        {
            return _conversation.Messages
                .Select(m => string.Format("{0}: {1}",
                    m.Sender.UserName,
                    m.Body));
        }
    }
}

Lesson 1a: Identity
Lesson 1b: Unique
Lesson 1c: Predecessors
Lesson 1d: Successors
Practice 1: Define a query

Lesson 2a: Partial classes
Lesson 2b: View model
Lesson 2c: Command activation
Lesson 2d: Data binding
Practice 2: Create a view model
Practice 2: Data bind thew new view model

Lesson 3a: Negative facts
Lesson 3b: Negative command in the view model
Lesson 3c: Enable and disable the negative command
Lesson 3d: Data bind the negative command
Practice 3: Create a negative fact

Lesson 4a: Publish subscribe
Lesson 4b: Correspondence Server
Practice 4: Subscribe to games

Last edited Dec 29, 2013 at 6:54 PM by MichaelLPerry1971, version 31