//
// Licensed under the MIT License. See LICENSE file in the project root for full license information.
//
namespace MUnique.OpenMU.Persistence.EntityFramework;
using System.Threading;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using MUnique.OpenMU.Persistence.EntityFramework.Model;
///
/// Persistence context which is used to access the .
///
internal class GameConfigurationContext : CachingEntityFrameworkContext, IConfigurationContext
{
///
/// Initializes a new instance of the class.
///
/// The repository provider.
/// The logger.
public GameConfigurationContext(IContextAwareRepositoryProvider repositoryProvider, ILogger logger)
: base(new ConfigurationContext(), repositoryProvider, null, logger)
{
}
///
public async ValueTask GetDefaultGameConfigurationIdAsync(CancellationToken cancellationToken)
{
return await this.Context.Set().Select(g => g.Id).FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
}
}