protected DefaultModelBinderSpecifications() { var engine = UWebConfiguration.Configure<Bootstrapper>().BuildEngine(); engine.Container.Set<IRequest>(new Request("GET", "/", "http", engine.Container.Resolve<IHttpUtility>())); engine.Container.Set<IBindingSourceCollection>(new BindingSourceCollection(new List<IBindingSource> { new SimpleBindingSource(), new ComplexBindingSource() })); ResolveDependencies = engine.Container; PropertyBinderCollection = engine.Container.Resolve<IPropertyBinderCollection>(); }
protected void SaveSagaState(dynamic saga, IResolveDependencies resolver, string id, bool isNew = false) { if (UseCustomRepositories && SaveSagaToCustom(saga, resolver, isNew)) { return; } var grepo = GetSagaRepository(resolver); grepo.Save(saga, id, isNew); this.LogDebug("Saga data '{0}' saved", SagaStateType); }
ISagaState GetSagaStateFromCustom(IEvent evnt, IResolveDependencies resolver) { var evntType = evnt.GetType(); dynamic repo = resolver.ResolveOptional(typeof(IFindSagaState<>.Using<>).MakeGenericType(SagaStateType, evntType)); if (repo == null) { return null; } string fullName = repo.GetType().FullName; this.LogDebug($"Using saga repository '{fullName}' ..."); return repo.GetSagaData((dynamic) evnt); }
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 SparkViewEngine(ITemplateFinderCollection templateFinderCollection, IDescriptorBuilder descriptorBuilder, ISparkViewEngine engine, IFilterViewsCollection filterViewsCollection, IResolveDependencies resolveDependencies) { templateFinderCollection.ArgumentNullCheck("templateFinderCollection"); descriptorBuilder.ArgumentNullCheck("descriptorBuilder"); engine.ArgumentNullCheck("engine"); filterViewsCollection.ArgumentNullCheck("filterViewsCollection"); resolveDependencies.ArgumentNullCheck("resolveDependencies"); this.templateFinderCollection = templateFinderCollection; this.descriptorBuilder = descriptorBuilder; this.engine = engine; this.filterViewsCollection = filterViewsCollection; this.resolveDependencies = resolveDependencies; }
ISagaState GetSagaStateFromCustom(IEvent evnt, IResolveDependencies resolver) { var evntType = evnt.GetType(); dynamic repo = resolver.ResolveOptional(typeof(IFindSagaState <> .Using <>).MakeGenericType(SagaStateType, evntType)); if (repo == null) { return(null); } string fullName = repo.GetType().FullName; this.LogDebug($"Using saga repository '{fullName}' ..."); return(repo.GetSagaData((dynamic)evnt)); }
private bool SaveSagaToCustom(dynamic saga, IResolveDependencies resolver, bool isNew) { dynamic repo = resolver.ResolveOptional(typeof(ISaveSagaState <>).MakeGenericType(SagaStateType)); this.LogDebug("Saving saga {0} ...", SagaStateType.Name); if (repo == null) { return(false); } string fullName = repo.GetType().FullName; this.LogDebug("Using repository '{0}'", fullName); repo.Save(saga, isNew); return(true); }
protected ISagaState GetSagaState(IEvent evnt, IResolveDependencies resolver, string correlationId) { evnt.MustNotBeNull(); this.LogDebug($"Loading saga {SagaStateType.Name} ..."); ISagaState res = null; if (UseCustomRepositories) { res = GetSagaStateFromCustom(evnt, resolver); if (res != null) return res; } var grepo = GetSagaRepository(resolver); return grepo.GetSaga(correlationId,SagaStateType); }
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; }
protected ISagaState GetSagaState(IEvent evnt, IResolveDependencies resolver, string correlationId) { evnt.MustNotBeNull(); this.LogDebug($"Loading saga {SagaStateType.Name} ..."); ISagaState res = null; if (UseCustomRepositories) { res = GetSagaStateFromCustom(evnt, resolver); if (res != null) { return(res); } } var grepo = GetSagaRepository(resolver); return(grepo.GetSaga(correlationId, SagaStateType)); }
public void SetUp() { resolveDependencies = A.Fake<IResolveDependencies>(); propertyBinderCollection = A.Fake<IPropertyBinderCollection>(); propertyBinder = A.Fake<IPropertyBinder>(); bindingContext = A.Fake<IBindingContext>(); modelBinder = new DefaultModelBinder(resolveDependencies, propertyBinderCollection); A.CallTo(() => propertyBinderCollection.GetMatching(A<PropertyInfo>.Ignored)).Returns(propertyBinder); }
private bool SaveSagaToCustom(dynamic saga, IResolveDependencies resolver, bool isNew) { dynamic repo = resolver.ResolveOptional(typeof (ISaveSagaState<>).MakeGenericType(SagaStateType)); this.LogDebug("Saving saga {0} ...", SagaStateType.Name); if (repo == null) return false; string fullName = repo.GetType().FullName; this.LogDebug("Using repository '{0}'", fullName); repo.Save(saga, isNew); return true; }
public IConfigureMigrationsRunner WithResolver(IResolveDependencies resolver) { resolver.MustNotBeNull(); _resolver = resolver; return(this); }
protected virtual IEnumerable<IStartupTask> ResolveStartupTasks(IResolveDependencies resolveDependencies) { return resolveDependencies.ResolveAll<IStartupTask>(); }
public DefaultModelBinder(IResolveDependencies resolveDependencies, IPropertyBinderCollection propertyBinderCollection) { this.resolveDependencies = resolveDependencies; this.propertyBinderCollection = propertyBinderCollection; }
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); }
protected void SaveSagaState(dynamic saga, IResolveDependencies resolver, string id,bool isNew=false) { if (UseCustomRepositories && SaveSagaToCustom(saga, resolver, isNew)) return; var grepo = GetSagaRepository(resolver); grepo.Save(saga, id, isNew); this.LogDebug("Saga data '{0}' saved", SagaStateType); }
public void SetUp() { templateFinderCollection = A.Fake<ITemplateFinderCollection>(); descriptorBuilder = A.Fake<IDescriptorBuilder>(); sparkViewEngine = A.Fake<ISparkViewEngine>(); filterViewsCollection = A.Fake<IFilterViewsCollection>(); resolveDependencies = A.Fake<IResolveDependencies>(); endpoint = A.Fake<IEndpoint>(); endpointMethodInfo = new DynamicMethod("Test", typeof(string), new Type[0]); A.CallTo(() => endpoint.Method).Returns(endpointMethodInfo); viewEngine = new SparkViewEngine(templateFinderCollection, descriptorBuilder, sparkViewEngine, filterViewsCollection, resolveDependencies); }