using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Samples.ServiceHosting.StorageClient;
namespace newtelligence.DasBlog.Runtime.Azure{
public class BlogEntryEntity : TableStorageEntity
{
/// <summary>
/// Default constructor required by the Azure Table storage.
/// </summary>
public BlogEntryEntity() { }
public BlogEntryEntity(Entry entry)
{
// infra structure
this.PartitionKey = entry.Author.ToLowerInvariant();
this.RowKey = entry.EntryId;
this.Content = entry.Content;
this.Modified = entry.ModifiedUtc;
this.Created = entry.CreatedUtc;
this.Description = entry.Description;
this.Title = entry.Title;
this.Link = entry.Link;
this.Categories = entry.Categories;
this.Author = entry.Author;
this.IsPublic = entry.IsPublic;
this.Syndicated = entry.Syndicated;
this.ShowOnFrontPage = entry.ShowOnFrontPage;
this.AllowComments = entry.AllowComments;
this.Latitude = entry.Latitude;
this.Longitude = entry.Longitude;
}
public DateTime Created
{
get;
set;
}
public DateTime Modified
{
get;
set;
}
public string Content
{
get;
set;
}
public string Description
{
get;
set;
}
public string Title
{
get;
set;
}
public string Link
{
get;
set;
}
public string Categories
{
get;
set;
}
public string Author
{
get;
set;
}
public bool IsPublic
{
get;
set;
}
public bool Syndicated
{
get;
set;
}
public bool ShowOnFrontPage
{
get;
set;
}
public bool AllowComments
{
get;
set;
}
public Nullable<double> Latitude
{
get;
set;
}
public Nullable<double> Longitude
{
get;
set;
}
public Entry GetValue()
{
return new Entry()
{
EntryId = this.RowKey,
Description = this.Description,
Title = this.Title,
Link = this.Link,
Categories = this.Categories,
Author = this.Author,
IsPublic = this.IsPublic,
Syndicated = this.Syndicated,
ShowOnFrontPage = this.ShowOnFrontPage,
AllowComments = this.AllowComments,
Latitude = this.Latitude,
Longitude = this.Longitude,
Content = this.Content,
ModifiedUtc = this.Modified,
CreatedUtc = this.Created,
};
}
internal void Update(Entry entry)
{
if (entry == null) { throw new ArgumentNullException("entry"); }
this.Description = entry.Description;
this.Title = entry.Title;
this.Link = entry.Link;
this.Categories = entry.Categories;
this.Author = entry.Author;
this.IsPublic = entry.IsPublic;
this.Syndicated = entry.Syndicated;
this.ShowOnFrontPage = entry.ShowOnFrontPage;
this.AllowComments = entry.AllowComments;
this.Latitude = entry.Latitude;
this.Longitude = entry.Longitude;
this.Content = entry.Content;
this.Modified = entry.ModifiedUtc;
}
}
}
|