2019-01-24 08:43:03 +00:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2018-02-12 14:10:05 +00:00
|
|
|
|
namespace osu.Game.Database
|
|
|
|
|
{
|
|
|
|
|
public interface IDatabaseContextFactory
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a context for read-only usage.
|
|
|
|
|
/// </summary>
|
|
|
|
|
OsuDbContext Get();
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-02-12 14:10:05 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Request a context for write usage. Can be consumed in a nested fashion (and will return the same underlying context).
|
|
|
|
|
/// This method may block if a write is already active on a different thread.
|
|
|
|
|
/// </summary>
|
2018-05-29 01:59:39 +00:00
|
|
|
|
/// <param name="withTransaction">Whether to start a transaction for this write.</param>
|
2018-02-12 14:10:05 +00:00
|
|
|
|
/// <returns>A usage containing a usable context.</returns>
|
2018-05-29 01:59:39 +00:00
|
|
|
|
DatabaseWriteUsage GetForWrite(bool withTransaction = true);
|
2018-02-12 14:10:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|