예제 #1
0
        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));
                }
            }
        }
예제 #2
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"));
        }
예제 #3
0
 // 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);
 }
예제 #4
0
            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;
            }