Correspondence Overview

Correspondence is a collaboration framework for occasionally-connected clients. Express your model once, and it gives you local storage, synchronization, and push notification across devices. We currently support Windows Store, Windows Phone, WPF, ASP.NET, Android, and Silverlight.

Collaborative framework

People don’t just own one computer anymore. Now they have a desktop, a laptop, and a phone. They want their data to seamlessly flow across all of their devices.

People take their devices with them. These devices aren’t always connected. And even when they are, people don’t want to wait for them to connect to a central server. Everyone should have their own data on their own device for immediate access.

People use software to collaborate with each other. Some domains are overtly collaborative, such as social networking and gaming. Others are more discreet, like customer relationship management and project planning. Actions performed by collaborators affect the user experience.

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 your peers.

public partial class Conversation
{
    public async Task SendMessageAsync(User sender, string body)
    {
        await Community.AddFactAsync(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 readonly 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));
        }
    }
}

Videos

Get started

These are the resources you will need to build a collaborative application using Correspondence.

  1. Add the Correspondence.AllInOne package to an application.
  2. Follow the tutorial to learn how to build a Correspondence model.