/// <summary> /// Create a new event stream from the attribute passed in /// </summary> /// <param name="attribute"> /// The EventStreamAttribute tagging the parameter to crreate by dependency injection /// </param> /// <param name="context"> /// The context within which this binding is occuring /// </param> /// <returns> /// A task that can create an event stream when required /// </returns> public static Task <EventStream> BuildEventStreamFromAttribute(EventStreamAttribute attribute, ValueBindingContext context) { // If possible get the event stream settings to use // If possible, get the write context to use IWriteContext writeContext = WriteContext.CreateFunctionContext(context.FunctionContext); // If possible, get the notification dipatcher to use INotificationDispatcher dispatcher = NotificationDispatcherFactory.NotificationDispatcher; // Use this and the attribute to create a new event stream instance return(Task <EventStream> .FromResult(new EventStream(attribute, context : writeContext, dispatcher : dispatcher ))); }