Beispiel #1
0
        public async Task SupportsEnlistingInAmbientTransactions(TransactionScopeOption scopeOption)
        {
            var name  = Enum.GetName(typeof(TransactionScopeOption), scopeOption);
            var pocoA = new PocoA {
                Name = $"{name}--{Guid.NewGuid()}", Value = 1
            };
            var pocoB = new PocoB {
                Name = $"{name}--{Guid.NewGuid()}", Value = 2
            };

            var result = await _commander.ExecuteAsync(() =>
            {
                var t1 = _commander.Execute(pocoA) ? pocoA : null;
                var t2 = _commander.Execute(pocoB) ? pocoB : null;

                return(new MultiMapPocoB
                {
                    PocoA = t1,
                    PocoB = t2
                });
            }, scopeOption);

            NotNull(result);
            NotNull(result.PocoA);
            NotNull(result.PocoB);
        }