コード例 #1
0
        /// <summary>
        /// Saves the changes made by the client, with an additional root model validation performed by the provided or default <see cref="IModelSaveValidator"/>.
        /// </summary>
        /// <typeparam name="TModel">The root model type.</typeparam>
        /// <param name="saveBundle">The changes to save.</param>
        /// <param name="configureAction">The save configuration action.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>The save result.</returns>
        public Task <SaveResult> SaveChangesAsync <TModel>(SaveBundle saveBundle, Action <AsyncSaveChangesOptionsConfigurator <TModel> > configureAction, CancellationToken cancellationToken = default)
        {
            var configurator = new AsyncSaveChangesOptionsConfigurator <TModel>(_modelSaveValidatorProvider.Get(typeof(TModel)));

            configureAction?.Invoke(configurator);

            return(SaveChangesAsync(saveBundle, configurator.SaveChangesOptions, cancellationToken));
        }
コード例 #2
0
        /// <summary>
        /// Saves the changes made by the client.
        /// </summary>
        /// <param name="saveBundle">The changes to save.</param>
        /// <param name="configureAction">The save configuration action.</param>
        /// <param name="cancellationToken">The cancellation token</param>
        /// <returns>The save result.</returns>
        public Task <SaveResult> SaveChangesAsync(SaveBundle saveBundle, Action <AsyncSaveChangesOptionsConfigurator> configureAction, CancellationToken cancellationToken = default)
        {
            var configurator = new AsyncSaveChangesOptionsConfigurator();

            configureAction?.Invoke(configurator);

            return(SaveChangesAsync(saveBundle, configurator.SaveChangesOptions, cancellationToken));
        }