Project DescriptionA 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.
Download using NuGet
Add the Correspondence AllInOne package that's right for your application:
- Silverlight - Correspondence.Silverlight.AllInOne
- Windows Phone - Correspondence.WindowsPhone.AllInOne
- WPF - Correspondence.Desktop.AllInOne
- MVC 3 - Correspondence.Web.AllInOne
See the Readme.txt file for additional instructions.
After learning your way around, try the testable version.
- Model Create a class library and add Correspondence.Model
- ViewModel Create another class library and add Correspondence. Add a reference to Model.
- UnitTest Create a Silverlight or Windows Phone application, or a Desktop or Web unit test project. Add Correspondence.*.UnitTest. Add a reference to both Model and ViewModel.
- Application Create an application and add Correspondence.*.App. Add a reference to both Model and ViewModel.
Step 1: define a factYou 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 communityAdding 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 factsA 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 resultsQuery 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: IdentityLesson 1b: UniqueLesson 1c: PredecessorsLesson 1d: SuccessorsPractice 1: Define a queryLesson 2a: Partial classesLesson 2b: View modelLesson 2c: Command activationLesson 2d: Data bindingPractice 2: Create a view modelPractice 2: Data bind thew new view modelLesson 3a: Negative factsLesson 3b: Negative command in the view modelLesson 3c: Enable and disable the negative commandLesson 3d: Data bind the negative commandPractice 3: Create a negative factLesson 4a: Publish subscribeLesson 4b: Correspondence ServerPractice 4: Subscribe to games