public void Initialize()
        {
            _community = new Community(IsolatedStorageStorageStrategy.Load())
                .Register<CorrespondenceModel>()
                ;

            _community.AddAsynchronousCommunicationStrategy(new BinaryHTTPAsynchronousCommunicationStrategy(new HttpConfigurationProvider()));

            _identity = _community.LoadFact<Identity>(ThisIdentity);
            if (_identity == null)
            {
                string randomId = Punctuation.Replace(Guid.NewGuid().ToString(), String.Empty).ToLower();
                _identity = _community.AddFact(new Identity(randomId));
                _community.SetFact(ThisIdentity, _identity);
            }

            _community.BeginSending();
        }
Esempio n. 2
0
 // Fields
 // Results
 // Business constructor
 public Share(
     Identity identity
     ,Company company
     )
 {
     _unique = Guid.NewGuid();
     InitializeResults();
     _identity = new PredecessorObj<Identity>(this, GetRoleIdentity(), identity);
     _company = new PredecessorObj<Company>(this, GetRoleCompany(), company);
 }
Esempio n. 3
0
            public CorrespondenceFact CreateFact(FactMemento memento)
            {
                Identity newFact = new Identity(memento);

                // Create a memory stream from the memento data.
                using (MemoryStream data = new MemoryStream(memento.Data))
                {
                    using (BinaryReader output = new BinaryReader(data))
                    {
                        newFact._anonymousId = (string)_fieldSerializerByType[typeof(string)].ReadData(output);
                    }
                }

                return newFact;
            }