public EntitySnapshot(EntitySnapshot other, dynamic content)
        {
            Contract.Requires<ArgumentNullException>(other != null);

            if (content == null)
            {
                this.adapter = ExpandoAdapter.Empty;
            }
            else if (content is ExpandoObject)
            {
                this.adapter = new ExpandoAdapter(content);
            }
            else
            {
                dynamic expandoObject = new ExpandoObject();
                expandoObject.Value = content;
                this.adapter = new ExpandoAdapter(expandoObject);
            }

            this.author = other.Author;
            this.id = other.Id;
            this.links = other.Links;
            this.published = other.Published;
            this.title = other.Title;
            this.updated = other.Updated;
        }
Exemplo n.º 2
0
        protected async Task UpdateSnapshotAsync(Response response)
        {
            var feed = new AtomFeed();
            await feed.ReadXmlAsync(response.XmlReader);

            if (feed.Entries.Count != 1)
            {
                throw new InvalidDataException();  // TODO: Diagnostics
            }

            this.Snapshot = new EntitySnapshot(feed.Entries[0]);
        }