Esempio n. 1
0
        /// <summary>
        ///     Helps call the <see cref="IDependencyCoordinator"/> with the correct parameters.
        /// </summary>
        /// <typeparam name="TResult">The type of the result</typeparam>
        /// <param name="coordinator">The instance to use as the dependency coordinator</param>
        /// <param name="work">The function to be invoked</param>
        /// <param name="name">The name of the dependency</param>
        /// <param name="addMetadataFunc">Any additional information to be passed into the metadata of the dependency</param>
        /// <returns>an awaitable <see cref="Task{TResult}"/></returns>
        public static Task <TResult> CallDependency <TResult>(
            this IDependencyCoordinator coordinator,
            Func <Task <TResult> > work,
            [CallerMemberName] string?name = null,
            Action <TResult, Dictionary <string, object> >?addMetadataFunc = null)
        {
            var metadata = new DependencyMetadata <TResult>(name, addMetadataFunc);

            return(coordinator.ExecuteAsync(work, metadata));
        }
Esempio n. 2
0
        /// <summary>
        ///     Helps call the <see cref="IDependencyCoordinator"/> with the correct parameters.
        /// </summary>
        /// <param name="coordinator">The instance to use as the dependency coordinator</param>
        /// <param name="work">The function to be invoked</param>
        /// <param name="name">The name of the dependency</param>
        /// <param name="additionalMetadata">Any additional information to be passed into the metadata of the dependency</param>
        /// <returns>an awaitable <see cref="Task"/></returns>
        public static Task CallDependency(
            this IDependencyCoordinator coordinator,
            Func <Task> work,
            [CallerMemberName] string?name = null,
            Dictionary <string, object>?additionalMetadata = null)
        {
            var metadata = new DependencyMetadata(name, additionalMetadata);

            return(coordinator.ExecuteAsync(work, metadata));
        }
Esempio n. 3
0
 public DynamoDbClient(IAmazonDynamoDB client, IDependencyCoordinator coordinator)
 {
     this.client      = client ?? throw new ArgumentNullException(nameof(client));
     this.coordinator = coordinator ?? throw new ArgumentNullException(nameof(coordinator));
 }