//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Persistence.InMemory;
using System.Threading;
using MUnique.OpenMU.Persistence.BasicModel;
///
/// A context which is used to access the configuration data in-memory.
///
public class ConfigurationInMemoryContext : InMemoryContext, IConfigurationContext
{
///
/// Initializes a new instance of the class.
///
/// The manager which holds the memory repositories.
public ConfigurationInMemoryContext(InMemoryRepositoryProvider provider)
: base(provider)
{
}
///
public async ValueTask GetDefaultGameConfigurationIdAsync(CancellationToken cancellationToken)
{
var allConfigs = await this.Provider.GetRepository().GetAllAsync(cancellationToken).ConfigureAwait(false);
return allConfigs.FirstOrDefault()?.Id;
}
}