public ObjectDef RepositoryFor(SagaTypes sagaTypes) { if (sagaTypes.StateType.GetProperty(SagaTypes.Id) == null) { return null; } var objectDef = new ObjectDef(typeof (InMemorySagaRepository<,>), sagaTypes.StateType, sagaTypes.MessageType); objectDef.DependencyByValue(typeof(Func<,>).MakeGenericType(sagaTypes.StateType, typeof(Guid)), sagaTypes.ToSagaIdFunc()); objectDef.DependencyByValue(typeof(Func<,>).MakeGenericType(sagaTypes.MessageType, typeof(Guid)), sagaTypes.ToCorrelationIdFunc()); return objectDef; }
public ObjectDef RepositoryFor(SagaTypes sagaTypes) { if (sagaTypes.StateType.GetProperty(SagaTypes.Id) == null) { return(null); } var objectDef = new ObjectDef(typeof(InMemorySagaRepository <,>), sagaTypes.StateType, sagaTypes.MessageType); objectDef.DependencyByValue(typeof(Func <,>).MakeGenericType(sagaTypes.StateType, typeof(Guid)), sagaTypes.ToSagaIdFunc()); objectDef.DependencyByValue(typeof(Func <,>).MakeGenericType(sagaTypes.MessageType, typeof(Guid)), sagaTypes.ToCorrelationIdFunc()); return(objectDef); }
protected override ObjectDef buildObjectDef() { var def = new ObjectDef(typeof (ChromeBehavior<>), _contentType); def.DependencyByValue<Action<ChromeContent>>(content => content.Title = Title()); return def; }
public void build_an_object_with_dependencies() { var request = new InMemoryFubuRequest(); var def = new ObjectDef(typeof (FakeJsonBehavior)); def.DependencyByValue(typeof (IFubuRequest), request); var jsonWriter = def.DependencyByType(typeof (IJsonWriter), typeof (AjaxAwareJsonWriter)); jsonWriter.DependencyByType(typeof (IOutputWriter), typeof (OutputWriter)); jsonWriter.DependencyByType(typeof(IRequestData), typeof(InMemoryRequestData)); def.DependencyByType(typeof (IRequestData), typeof (InMemoryRequestData)); var container = new Container(x => { x.For<IFileSystem>().Use<FileSystem>(); x.For<IHttpWriter>().Use<NulloHttpWriter>(); x.For<IActionBehavior>().UseInstance(new ObjectDefInstance(def)); x.For<ILogger>().Use<Logger>(); x.For<ISystemTime>().Use(() => SystemTime.Default()); }); var jsonBehavior = container.GetInstance<IActionBehavior>().ShouldBeOfType<FakeJsonBehavior>(); jsonBehavior.Writer.ShouldBeOfType<AjaxAwareJsonWriter>(); jsonBehavior.Request.ShouldBeTheSameAs(request); }
public void build_an_object_with_dependencies() { var request = new InMemoryFubuRequest(); var def = new ObjectDef(typeof(FakeJsonBehavior)); def.DependencyByValue(typeof(IFubuRequest), request); var jsonWriter = def.DependencyByType(typeof(IJsonWriter), typeof(AjaxAwareJsonWriter)); jsonWriter.DependencyByType(typeof(IOutputWriter), typeof(OutputWriter)); jsonWriter.DependencyByType(typeof(IRequestData), typeof(InMemoryRequestData)); def.DependencyByType(typeof(IRequestData), typeof(InMemoryRequestData)); var container = new Container(x => { x.For <IFileSystem>().Use <FileSystem>(); x.For <IHttpWriter>().Use <NulloHttpWriter>(); x.For <IActionBehavior>().Use(new ObjectDefInstance(def)); x.For <ILogger>().Use <Logger>(); x.For <ISystemTime>().Use(SystemTime.Default); }); var jsonBehavior = container.GetInstance <IActionBehavior>().ShouldBeOfType <FakeJsonBehavior>(); jsonBehavior.Writer.ShouldBeOfType <AjaxAwareJsonWriter>(); jsonBehavior.Request.ShouldBeTheSameAs(request); }
protected override ObjectDef buildObjectDef() { var def = new ObjectDef(typeof (TopicBehavior)); def.DependencyByValue(_topic); return def; }
public BottleConfigurationDef(string provenance) { _objectDef = new ObjectDef(typeof(AssertBottleConfiguration)); _objectDef.DependencyByValue(provenance); _rules = _objectDef.EnumerableDependenciesOf <IBottleConfigurationRule>(); }
protected override void configureObject(ObjectDef def) { def.DependencyByValue(new ViewPath { ViewName = _viewName }); }
protected override ObjectDef buildObjectDef() { var def = new ObjectDef(typeof(OptionalAssetsBehavior)); def.DependencyByValue(_assetName); return(def); }
protected override void configureObject(ObjectDef def) { def.DependencyByValue(new ViewPath { ViewName = _viewName }); }
public static ObjectDef ForService <T>(Func <T, bool> filter) { var def = new ObjectDef(typeof(LambdaConditional <>), typeof(T)); def.DependencyByValue(filter); return(def); }
protected override ObjectDef toWriterDef() { var objectDef = new ObjectDef(typeof(FeedWriter <T>)); objectDef.DependencyByValue(typeof(IFeedDefinition <T>), _feed); return(objectDef); }
public ObjectDef ToObjectDef() { var def = new ObjectDef(typeof(PollingJob <,>), JobType, SettingType); def.DependencyByValue(this); return(def); }
public static ObjectDef For(Func <bool> filter) { var def = new ObjectDef(typeof(LambdaConditional)); def.DependencyByValue(filter); return(def); }
protected override ObjectDef buildObjectDef() { var def = new ObjectDef(typeof(ChromeBehavior <>), _contentType); def.DependencyByValue <Action <ChromeContent> >(content => content.Title = Title()); return(def); }
protected override ObjectDef buildObjectDef() { var tracerDef = new ObjectDef(typeof (BehaviorTracer)); var chain = ParentChain(); tracerDef.DependencyByValue(new BehaviorCorrelation(Next)); return tracerDef; }
public ObjectDef ToObjectDef(DiagnosticLevel level) { var objectDef = new ObjectDef(typeof(FeedWriter <T>)); objectDef.DependencyByType(typeof(IFeedSource <T>), FeedSourceType); objectDef.DependencyByValue(typeof(IFeedDefinition <T>), _feed); return(objectDef); }
public static ObjectDef ForModel <T>(Func <T, bool> filter) where T : class { var def = new ObjectDef(typeof(LambdaConditional <>), typeof(IFubuRequest)); Func <IFubuRequest, bool> match = request => filter(request.Get <T>()); def.DependencyByValue(match); return(def); }
protected override ObjectDef buildObjectDef() { var tracerDef = new ObjectDef(typeof(BehaviorTracer)); var chain = ParentChain(); tracerDef.DependencyByValue(new BehaviorCorrelation(Next)); return(tracerDef); }
protected override ObjectDef buildObjectDef() { var def = new ObjectDef(typeof(InputBehavior <>), _inputType); var collection = typeof(ReaderCollection <>).CloseAndBuildAs <object>(this, _inputType); var collectionType = typeof(IReaderCollection <>).MakeGenericType(_inputType); def.DependencyByValue(collectionType, collection); return(def); }
protected override ObjectDef buildObjectDef() { ObjectDef def = ObjectDef.ForType <TopicBehavior>(); def.DependencyByValue(typeof(Topic), Topic); ObjectDef viewDef = Topic.File.ToViewToken().ToViewFactoryObjectDef(); def.Dependency(typeof(IViewFactory), viewDef); return(def); }
protected override ObjectDef toWriterDef() { var def = new ObjectDef(typeof(ViewWriter<>), ResourceType); def.DependencyByType<IViewFactory>(_token.ToViewFactoryObjectDef()); var activator = new ObjectDef(typeof (FubuPageActivator<>), _token.ViewModel); activator.DependencyByValue(typeof (IViewToken), _token); def.Dependency(typeof (IFubuPageActivator), activator); return def; }
protected override ObjectDef toWriterDef() { var def = new ObjectDef(typeof(ViewWriter <>), ResourceType); def.DependencyByType <IViewFactory>(_token.ToViewFactoryObjectDef()); var activator = new ObjectDef(typeof(FubuPageActivator <>), _token.ViewModel); activator.DependencyByValue(typeof(IViewToken), _token); def.Dependency(typeof(IFubuPageActivator), activator); return(def); }
private ObjectDef createTracerDef(ObjectDef objectDef) { var tracerDef = new ObjectDef(typeof(BehaviorTracer)); tracerDef.DependencyByType <IActionBehavior>(objectDef); var chain = ParentChain(); tracerDef.DependencyByValue(new BehaviorCorrelation { ChainId = chain == null ? Guid.Empty : chain.UniqueId, BehaviorId = UniqueId }); return(tracerDef); }
protected override ObjectDef buildObjectDef() { var def = new ObjectDef(typeof(OutputBehavior <>), _resourceType); var collectionType = typeof(IMediaCollection <>).MakeGenericType(_resourceType); var collection = typeof(MediaCollection <>).CloseAndBuildAs <object>(this, _resourceType); def.DependencyByValue(collectionType, collection); if (ResourceNotFound != null) { def.Dependency(typeof(IResourceNotFoundHandler), ResourceNotFound); } return(def); }
private ObjectDef createTracerDef(ObjectDef objectDef) { var tracerDef = new ObjectDef(typeof(BehaviorTracer)); tracerDef.DependencyByType<IActionBehavior>(objectDef); var chain = ParentChain(); tracerDef.DependencyByValue(new BehaviorCorrelation { ChainId = chain == null ? Guid.Empty : chain.UniqueId, BehaviorId = UniqueId }); return tracerDef; }
protected override void configureObject(ObjectDef def) { def.DependencyByValue(MimeType); }
protected override void configureObject(ObjectDef def) { def.DependencyByValue(_viewToken); def.DependencyByValue(_actionCall); }
protected override void configureObject(ObjectDef def) { def.DependencyByValue(_viewToken); def.DependencyByValue(_actionCall); }
protected override ObjectDef buildObjectDef() { var def = new ObjectDef(typeof (InputBehavior<>), _inputType); var collection = typeof (ReaderCollection<>).CloseAndBuildAs<object>(this, _inputType); var collectionType = typeof (IReaderCollection<>).MakeGenericType(_inputType); def.DependencyByValue(collectionType, collection); return def; }