public IRequestChainPart FindNext(RequestChainNode firstNode, IRequestChainPart requestChainPart, IResolveDependencies resolveDependencies, IRequest request) { if (requestChainPart != null) { firstNode = firstNode.Find(requestChainPart.GetType()).Next; if (firstNode == null) return null; } var currentRequestChainPart = (IRequestChainPart)resolveDependencies.Resolve(firstNode.Item); while (!currentRequestChainPart.ShouldUse(request)) { firstNode = firstNode.Find(currentRequestChainPart.GetType()).Next; if (firstNode == null) return null; currentRequestChainPart = (IRequestChainPart)resolveDependencies.Resolve(firstNode.Item); } return currentRequestChainPart; }
private IStoreSagaState GetSagaRepository(IResolveDependencies resolver) { IStoreSagaState grepo = null; try { grepo = resolver.Resolve<IStoreSagaState>(); this.LogDebug($"Using saga repository '{ grepo.GetType()}' ..."); } catch (Exception ex) { throw new DiContainerException(typeof(IStoreSagaState),ex); } return grepo; }
private IStoreSagaState GetSagaRepository(IResolveDependencies resolver) { IStoreSagaState grepo = null; try { grepo = resolver.Resolve <IStoreSagaState>(); this.LogDebug($"Using saga repository '{ grepo.GetType()}' ..."); } catch (Exception ex) { throw new DiContainerException(typeof(IStoreSagaState), ex); } return(grepo); }
public IManageMigrations Build() { if (_resolver == null) { throw new InvalidOperationException("Missing dependency resolver"); } var types = _asm .SelectMany(a => AssemblyExtensions.GetTypesImplementing <IMigrationTask>(a, true) .Select(t => (IMigrationTask)_resolver.Resolve(t))) .Where(t => t.CurrentVersion != null) .ToArray(); if (types.Length == 0) { throw new MigrationNotFoundException("None of the provided assemblies contained SqlFu migrations"); } var runner = new MigrationTaskRunner(_db, _log); return(new MigrationsManager(GetSchemaExecutors(types, runner), runner)); }
public void SetUp() { resolveDependencies = A.Fake<IResolveDependencies>(); request = A.Fake<IRequest>(); findNextRequestChainPart = new FindNextRequestChainPart(); firstRequestChainPart = new FirstRequestChainPart { ShouldUseValue = true }; secondRequestChainPart = new SecondRequestChainPart { ShouldUseValue = true }; thirdRequestChainPart = new ThirdRequestChainPart { ShouldUseValue = true }; A.CallTo(() => resolveDependencies.Resolve(typeof(FirstRequestChainPart))).Returns(firstRequestChainPart); A.CallTo(() => resolveDependencies.Resolve(typeof(SecondRequestChainPart))).Returns(secondRequestChainPart); A.CallTo(() => resolveDependencies.Resolve(typeof(ThirdRequestChainPart))).Returns(thirdRequestChainPart); }