EthenHY
EthenHY

Reputation: 551

Best practice use Azure storage in Windows Store

I use Azure storage class library in windows store. There is a DynamicTableEntity class, but I want to inhert TableEntity class like what we do in WPF.

So How to Create TableEntity Class in Windows store APP, can any one share the code? Now I just use code like this:

 public class PictureEntity
{
    private DynamicTableEntity entity;

    public PictureEntity()
    {
        //TODO:This username should be changed to User account in real app
        this.entity = new DynamicTableEntity() { PartitionKey = "UserName", RowKey = DateTime.Now.ToFileTime().ToString() };
    }

    public string Name { 
        get
        {
            return entity.Properties["FileName"].StringValue;
        }
        set
        {
            entity.Properties.Add(new KeyValuePair<string, EntityProperty>("FileName", new EntityProperty(value)));
        }
    }
    public string PictureUrl {
        get
        {
            return entity.Properties["ImageUrl"].StringValue;
        }
        set
        {
            entity.Properties.Add(new KeyValuePair<string, EntityProperty>("ImageUrl", new EntityProperty(value)));
        }
    }

    public string Description
    {
        get
        {
            return entity.Properties["Description"].StringValue;
        }
        set
        {
            entity.Properties.Add(new KeyValuePair<string, EntityProperty>("Description", new EntityProperty(value)));
        }
    }

    public DynamicTableEntity PictureTableEntity { get { return entity; } set {
        entity = value;
    } }
    public StorageFile PictureFile { get; set; }




}

Upvotes: 2

Views: 64

Answers (1)

Shahed C - MSFT
Shahed C - MSFT

Reputation: 2881

You could try using the Azure Storage Client Library for WinRT. For more information, see the following article in Microsoft's official Azure docuemntation:

How to use Azure Storage in Windows Store Apps

Not sure if you're still looking for this answer in 2015, but I hope it helps!

Upvotes: 1

Related Questions