Files
mixtape/zero.Core/Database/ZeroDocumentSession.cs
T

43 lines
1.2 KiB
C#
Raw Normal View History

2020-12-09 13:42:23 +01:00
using Raven.Client.Documents;
using Raven.Client.Documents.Session;
using System;
2021-10-13 12:47:18 +02:00
using zero.Core.Extensions;
2020-12-09 13:42:23 +01:00
namespace zero.Core.Database
{
2021-10-13 12:47:18 +02:00
public class ZeroDocumentSession : AsyncDocumentSession, IZeroDocumentSession
2020-12-09 13:42:23 +01:00
{
2021-10-13 12:47:18 +02:00
public IZeroDocumentSession Core { get; private set; }
2020-12-09 13:42:23 +01:00
2021-10-13 12:47:18 +02:00
public ZeroDocumentSession(DocumentStore documentStore, Guid id, SessionOptions options, string coreDatabase = null) : base(documentStore, id, options)
{
if (coreDatabase.HasValue())
{
Core = new ZeroDocumentSession(documentStore, id, new SessionOptions()
{
Database = coreDatabase,
DisableAtomicDocumentWritesInClusterWideTransaction = options.DisableAtomicDocumentWritesInClusterWideTransaction,
NoCaching = options.NoCaching,
NoTracking = options.NoTracking,
RequestExecutor = options.RequestExecutor,
TransactionMode = options.TransactionMode
});
}
else
{
Core = this;
}
2020-12-09 13:42:23 +01:00
}
2021-10-28 12:11:07 +02:00
public bool IsDisposed { get; set; }
2020-12-09 13:42:23 +01:00
}
2021-05-20 15:21:37 +02:00
2020-12-09 13:42:23 +01:00
public interface IZeroDocumentSession : IAsyncDocumentSession
{
2021-10-13 12:47:18 +02:00
IZeroDocumentSession Core { get; }
2021-10-28 12:11:07 +02:00
bool IsDisposed { get; }
}
2020-12-09 13:42:23 +01:00
}