public Task AddMessageAsync(Message message)
 {
     try
     {
         IChatService proxy = ServiceProxy.Create<IChatService>(this.defaultPartitionID, chatServiceInstance);
         return proxy.AddMessageAsync(message);
     }
     catch (Exception e)
     {
         ServiceEventSource.Current.Message("AddMessageAsync failed because of error {0}", e.ToString());
         throw;
     }
 }
        public async Task AddMessageAsync(Message message)
        {
            DateTime time = DateTime.Now.ToLocalTime();

            IReliableDictionary<DateTime, Message> messagesDictionary =
                await this.StateManager.GetOrAddAsync<IReliableDictionary<DateTime, Message>>("messages");

            using (ITransaction tx = this.StateManager.CreateTransaction())
            {
                await messagesDictionary.AddAsync(tx, time, message);
                await tx.CommitAsync();
            }
        }
 public Task AddMessageAsync(Message message)
 {
     try
     {
         // The service only has a single partition. In order to access the partition need to provide a
         // value in the LowKey - HighKey range defined in the ApplicationManifest.xml
         IChatService proxy = ServiceProxy.Create<IChatService>(chatServiceInstance, new ServicePartitionKey(1));
         return proxy.AddMessageAsync(message);
     }
     catch (Exception e)
     {
         ServiceEventSource.Current.Message("AddMessageAsync failed because of error {0}", e.ToString());
         throw;
     }
 }
 public Task AddMessageAsync(Message message)
 {
     Messages[DateTime.Now] = message;
     return Task.FromResult(true);
 }