-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathPersistenceEngineFixture.cs
More file actions
40 lines (36 loc) · 1.49 KB
/
PersistenceEngineFixture.cs
File metadata and controls
40 lines (36 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using NEventStore.Persistence.Sql.Tests;
namespace NEventStore.Persistence.AcceptanceTests {
using NEventStore.Persistence.Sql;
using NEventStore.Persistence.Sql.SqlDialects;
using NEventStore.Serialization;
using System.Data.SqlClient;
using System.Transactions;
public partial class PersistenceEngineFixture {
public ISqlDialect SqlDialect { get; set; } = new MsSqlDialect();
/// <summary>
/// this mimic the current NEventStore default values which is run outside any transaction (creates a scope that
/// suppresses any transaction)
/// </summary>
public TransactionScopeOption? ScopeOption { get; set; } // the old default: TransactionScopeOption.Suppress;
public PersistenceEngineFixture()
{
#if NET462
_createPersistence = pageSize =>
new SqlPersistenceFactory(new EnviromentConnectionFactory("MsSql", "System.Data.SqlClient"),
new BinarySerializer(),
SqlDialect,
pageSize: pageSize,
scopeOption: ScopeOption
).Build();
#else
_createPersistence = pageSize =>
new SqlPersistenceFactory(new EnviromentConnectionFactory("MsSql", SqlClientFactory.Instance),
new BinarySerializer(),
SqlDialect,
pageSize: pageSize,
scopeOption: ScopeOption
).Build();
#endif
}
}
}