public Task <AsyncResult <string> > GetUserPlaylistDataAsync(Guid profileId, Guid playlistId, string key)
        {
            ISQLDatabase database    = ServiceRegistration.Get <ISQLDatabase>();
            ITransaction transaction = database.BeginTransaction();

            try
            {
                int dataIndex;
                using (IDbCommand command = UserProfileDataManagement_SubSchema.SelectUserPlaylistDataCommand(transaction, profileId, playlistId,
                                                                                                              key, out dataIndex))
                {
                    using (IDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            string data = database.ReadDBValue <string>(reader, dataIndex);
                            return(Task.FromResult(new AsyncResult <string>(true, data)));
                        }
                    }
                }
                return(Task.FromResult(new AsyncResult <string>(false, null)));
            }
            finally
            {
                transaction.Dispose();
            }
        }
Esempio n. 2
0
        public bool GetUserPlaylistData(Guid profileId, Guid playlistId, string key, out string data)
        {
            ISQLDatabase database    = ServiceRegistration.Get <ISQLDatabase>();
            ITransaction transaction = database.BeginTransaction();

            try
            {
                int dataIndex;
                using (IDbCommand command = UserProfileDataManagement_SubSchema.SelectUserPlaylistDataCommand(transaction, profileId, playlistId,
                                                                                                              key, out dataIndex))
                {
                    using (IDataReader reader = command.ExecuteReader())
                    {
                        if (reader.Read())
                        {
                            data = database.ReadDBValue <string>(reader, dataIndex);
                            return(true);
                        }
                    }
                }
                data = null;
                return(false);
            }
            finally
            {
                transaction.Dispose();
            }
        }