private static void ServiceThreadProc() { // Load the correspondence database. string databaseFileName = Directory.ApplicationData / "FacetedWorlds" / "ReversiIdentificationService" / "Correspondence.sdf"; Community community = new Community(new SSCEStorageStrategy(databaseFileName)) .AddCommunicationStrategy(new WebServiceCommunicationStrategy()) .Register<CorrespondenceModule>() .Subscribe(() => _service); _service = community.AddFact(new IdentityService()); while (!_stop.WaitOne(TimeSpan.FromSeconds(15.0))) { try { Synchronize(community); if (RunService()) Synchronize(community); } catch (Exception ex) { // Wait 1 minute between exceptions. _stop.WaitOne(TimeSpan.FromMinutes(1.0)); } } }
public void Initialize() { MemoryCommunicationStrategy sharedCommunication = new MemoryCommunicationStrategy(); _serverCommunity = new Community(new MemoryStorageStrategy()) .AddCommunicationStrategy(sharedCommunication) .Register<CorrespondenceModel>() .Subscribe(() => _service); _clientCommunity = new Community(new MemoryStorageStrategy()) .AddCommunicationStrategy(sharedCommunication) .Register<CorrespondenceModel>() .Subscribe(() => _identity.Claims) .Subscribe(() => _identity); _otherClientCommunity = new Community(new MemoryStorageStrategy()) .AddCommunicationStrategy(sharedCommunication) .Register<CorrespondenceModel>() .Subscribe(() => _otherIdentity.Claims); _service = _serverCommunity.AddFact(new IdentityService()); _identity = _clientCommunity.AddFact(new Identity("liveid:12345")); _otherIdentity = _otherClientCommunity.AddFact(new Identity("liveid:12345")); }
// Business constructor public Claim( Identity identity ,User user ,IdentityService identityService ) { InitializeResults(); _identity = new PredecessorObj<Identity>(this, RoleIdentity, identity); _user = new PredecessorObj<User>(this, RoleUser, user); _identityService = new PredecessorObj<IdentityService>(this, RoleIdentityService, identityService); }
public CorrespondenceFact CreateFact(FactMemento memento) { IdentityService newFact = new IdentityService(memento); // Create a memory stream from the memento data. using (MemoryStream data = new MemoryStream(memento.Data)) { using (BinaryReader output = new BinaryReader(data)) { } } return newFact; }