Exemplo n.º 1
0
        async Task <BotData> IBotDataStore <BotData> .LoadAsync(IAddress key, BotStoreType botStoreType, CancellationToken cancellationToken)
        {
            using (var context = new SqlBotDataContext(_connectionStringName))
            {
                try
                {
                    SqlBotDataEntity entity = SqlBotDataEntity.GetSqlBotDataEntity(key, botStoreType, context);

                    if (entity == null)
                    {
                        return(new BotData(eTag: String.Empty, data: null));
                    }

                    return(new BotData(entity.ETag, entity.GetData()));
                }
                catch (Exception ex)
                {
                    throw new HttpException((int)HttpStatusCode.InternalServerError, ex.Message);
                }
            }
        }