using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using newtelligence.DasBlog.Runtime;
using Microsoft.Samples.ServiceHosting.StorageClient;
namespace newtelligence.DasBlog.Runtime.Azure{
public class LogDataEntity : TableStorageEntity
{
/// <summary>
///
/// </summary>
/// <remarks>Empty constructor required for Azure Data Services.</remarks>
public LogDataEntity()
: base()
{
//...
}
public LogDataEntity(LogDataItem dataItem, LogCategory category)
: base()
{
this.RequestedUtc = dataItem.RequestedUtc;
this.UrlRequested = dataItem.UrlRequested;
this.UrlReferrer = dataItem.UrlReferrer;
this.UserAgent = dataItem.UserAgent;
this.UserDomain = dataItem.UserDomain;
this.Category = category.ToString();
// change this?
this.PartitionKey = dataItem.RequestedUtc.ToLongDateString();
this.RowKey = dataItem.RequestedUtc.ToString("HH:mm:ss.ffff");
}
public LogDataItem GetLogDataItem()
{
return new LogDataItem()
{
RequestedUtc = this.RequestedUtc,
UrlRequested = this.UrlRequested,
UrlReferrer = this.UrlReferrer,
UserAgent = this.UserAgent,
UserDomain = this.UserDomain,
};
}
public DateTime RequestedUtc { get; set; }
public string UrlRequested { get; set; }
public string UrlReferrer { get; set; }
public string UserAgent { get; set; }
public string UserDomain { get; set; }
public string Category { get; set; }
}
}
|